File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,16 @@ interface MotionContextProps {
66
77export const Context = React . createContext < MotionContextProps > ( { } ) ;
88
9- export default function MotionProvider ( {
10- children,
11- ...props
12- } : MotionContextProps & { children ?: React . ReactNode } ) {
13- return < Context . Provider value = { props } > { children } </ Context . Provider > ;
14- }
9+ const MotionProvider : React . FC <
10+ React . PropsWithChildren < MotionContextProps >
11+ > = props => {
12+ const { children, ...rest } = props ;
13+
14+ const memoizedValue = React . useMemo < MotionContextProps > ( ( ) => {
15+ return { motion : rest . motion } ;
16+ } , [ rest . motion ] ) ;
17+
18+ return < Context . Provider value = { memoizedValue } > { children } </ Context . Provider > ;
19+ } ;
20+
21+ export default MotionProvider ;
You can’t perform that action at this time.
0 commit comments