[typescript] How to type poor component with animated.div inside? #1796
-
Hey! For example:
|
Beta Was this translation helpful? Give feedback.
Answered by
joshuaellis
Dec 21, 2021
Replies: 1 comment
-
You can either use type SpaceItemMarkProps = {
springs: SpringValues<{
opacity: number
}>
}
export const SpaceItemMark = ({springs}: SpaceItemMarkProps) => (
<animated.div
sx={{
display: 'flex',
height: 52,
width: 52,
alignItems: 'center',
justifyContent: 'flex-end',
position: 'absolute',
right: 24,
}}
style={
springs
}
>
<SvgIconSelectedProperty116X16 />
</animated.div>
);
const App = () => {
const springs = useSpring({
opacity: 1
})
return <SpaceItemMark springs={springs} />
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
gormonn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can either use
SpringValue
or what I would probably use isSpringValues
. I'm not familiar with what library you're using to enable thesx
prop but beside that this is how I would approach it