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

About props and State when using react.backbone #42

Open
walnutpedia opened this issue May 20, 2015 · 4 comments
Open

About props and State when using react.backbone #42

walnutpedia opened this issue May 20, 2015 · 4 comments

Comments

@walnutpedia
Copy link

I read some articles on React Props and State and get confused about that.
props should not be modified if I didn't misunderstand props and state...
when using react.backbone, the model was passing in a component via props, and the model definitely will change, right? is that proper to update the component this way?
sorry if this question is too silly...

@markijbema
Copy link
Collaborator

The props don't change, but their contents can change. So you pass a user. The user doesn't change, but his avatar_url might. In general the philosophy of backbone is a bit different from the philosophy of react, so in 'pure' react you indeed wouldn't do this, but pass in only a dumb object (like model.attributes)

@walnutpedia
Copy link
Author

@markijbema thanks for your comment. one interesting thing that i've found is that another plugin called backbone-react-component seems use the state to hold the model data. so maybe that's just two different ways. anyhow, they both work.

@alvesl
Copy link

alvesl commented Jul 11, 2016

+1 this confused me too. Thanks for clarifying - maybe add this quick explanation to README?

Thanks!

@markijbema
Copy link
Collaborator

Good idea; could you make a pull-request on the readme?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants