-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename "props" to "styles" or something else #734
Comments
You can name it whatever you like, no? const styles = useSpring({ ... })
const [styles, update] = useSpring(() => ({ ... })) |
You can, but would it be better if you don't have to? |
I don't understand. Can you give an example that would be easier? |
Ahh, you didn't mention |
Sorry about that. I know you can rename them |
the thing is, they're not styles, they can be, but essentially you're just interpolating arbitrary props, which you then cast into styles/attributes/etc. Curiously, react-motion naming it "styles" was often criticized for that reason, people were saying it was confusing as well: chenglou/react-motion#538 😄 but you're right, the api isn't optimal. sometimes i think that going for an object was a mistake over: transitions.map(([visible, key, styles]) => ... upside: naming, downside: you have to remember the correct order. we also had some other ideas, see: #665 |
Thanks for the explanation. |
wait, you're too quick : D this is a totally valid point, we can sure discuss how we can maybe solve it in a better way. feel free to give us your suggestions. do you like the array destructure for instance? |
The name
props
that is pass tostyle={}
is very confusing with the regular Reactprops.value
. I'm sure I'm not the only one thinking this. I've seen some tutorials that says it's confusing to them as well.I'm sure there is a reason why this is called props, but for me it's not helping.
styles
oranimations
is my suggestions.The text was updated successfully, but these errors were encountered: