Skip to content
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

Closed
dongepulango opened this issue Jul 2, 2019 · 9 comments
Closed

Rename "props" to "styles" or something else #734

dongepulango opened this issue Jul 2, 2019 · 9 comments
Labels
kind: bug Something isn't working

Comments

@dongepulango
Copy link

The name props that is pass to style={} is very confusing with the regular React props.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 or animations is my suggestions.

@dongepulango dongepulango added the kind: bug Something isn't working label Jul 2, 2019
@aleclarson
Copy link
Contributor

aleclarson commented Jul 2, 2019

You can name it whatever you like, no?

const styles = useSpring({ ... })
const [styles, update] = useSpring(() => ({ ... }))

@dongepulango
Copy link
Author

You can, but would it be better if you don't have to?

@aleclarson
Copy link
Contributor

I don't understand. Can you give an example that would be easier?

@dongepulango
Copy link
Author

Screen Shot 2019-07-02 at 8 56 59 PM
I mean there ^

@aleclarson
Copy link
Contributor

Ahh, you didn't mention useTransition specifically.

@dongepulango
Copy link
Author

Sorry about that. I know you can rename them props: styles but I just find it confusing sometimes, as well as other people in tutorials.

@drcmda
Copy link
Member

drcmda commented Jul 2, 2019

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

@dongepulango
Copy link
Author

Thanks for the explanation.

@drcmda
Copy link
Member

drcmda commented Jul 2, 2019

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants