Skip to content

Instantly share code, notes, and snippets.

@bone-house
bone-house / ViewContext.tsx
Created March 20, 2023 14:59
View transitions with R3F + spring + react-router-dom
import React, { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react'
import { useLocation } from 'react-router-dom'
export interface ViewProps {
// If the view has animations that should finish before route change happens
delayedTransition?: boolean
}
export interface ViewContext {
// If the browser's path is the same as context's path