Download react-spring/packages/core/src/components/Spring.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 951 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/core/src/components/Spring.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/core/src/components/Spring.tsx
-
curl -L -o Spring.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/core/src/components/Spring.tsx
951 Bytes
| import { JSX } from 'react' | |
| import { NoInfer, UnknownProps } from '@react-spring/types' | |
| import { useSpring, UseSpringProps } from '../hooks/useSpring' | |
| import { SpringValues, SpringToFn, SpringChain } from '../types' | |
| export type SpringComponentProps<State extends object = UnknownProps> = | |
| unknown & | |
| UseSpringProps<State> & { | |
| children: (values: SpringValues<State>) => React.JSX.Element | null | |
| } | |
| // Infer state from "from" object prop. | |
| export function Spring<State extends object>( | |
| props: { | |
| from: State | |
| to?: SpringChain<NoInfer<State>> | SpringToFn<NoInfer<State>> | |
| } & Omit<SpringComponentProps<NoInfer<State>>, 'from' | 'to'> | |
| ): JSX.Element | null | |
| // Infer state from "to" object prop. | |
| export function Spring<State extends object>( | |
| props: { to: State } & Omit<SpringComponentProps<NoInfer<State>>, 'to'> | |
| ): JSX.Element | null | |
| export function Spring({ children, ...props }: any) { | |
| return children(useSpring(props)) | |
| } | |