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

componentDidMount vs. componentWillMount #45

Open
dpwrussell opened this issue Dec 9, 2015 · 1 comment
Open

componentDidMount vs. componentWillMount #45

dpwrussell opened this issue Dec 9, 2015 · 1 comment

Comments

@dpwrussell
Copy link

Hey,

Thanks for creating an actual flux application which actually does something real with AJAX, the official documentation in this area is lacking in the extreme.

The docs specify that AJAX requests should be conducted in componentDidMount, not in componentWillMount. I'm curious why you've done it there instead?

All the flux examples I've seen have the subscription happening in componentWillMount.

I saw issue #23, but it didn't really make it clear to me why the switch was made. It looked to me like the double rendering was being caused by the component rendering with whatever blank initial state was specified and then rendered again as soon as the server responded with the real content, which updated the store, which caused it to rerender? That's a pattern I've seen a lot with React with and without Flux in my limited exposure so far, it seems perfectly normal.

Thanks for your time.

@igor10k
Copy link

igor10k commented Jun 1, 2016

I ended up with the same exact question. The issue is half a year old, so I'll try to bump it. @gaearon can you please answer this one?

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

2 participants