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

connectToStore executing render twice on mount intended? #23

Closed
broveloper opened this issue Mar 19, 2015 · 3 comments
Closed

connectToStore executing render twice on mount intended? #23

broveloper opened this issue Mar 19, 2015 · 3 comments

Comments

@broveloper
Copy link

I had a question regarding the connectToStore component. It is doing a this.setState on componentDidMount. This will cause the component to execute render twice when it gets mounted.

Was this intended? What was the reason for running the this.setState on componentDidMount when getInitialState already sets the state?

I'm genuinely curious to know if I'm missing some lifecycle knowledge in the React lifecycle.

@gaearon
Copy link
Owner

gaearon commented Mar 20, 2015

This is probably safe to remove. I'm trying to remember an edge case I fixed by this in my own app..

@broveloper
Copy link
Author

Thanks for responding gaearon!

emmenko added a commit to emmenko/flux-react-router-example that referenced this issue Mar 22, 2015
@gaearon gaearon closed this as completed May 5, 2015
@gaearon
Copy link
Owner

gaearon commented May 5, 2015

This is now removed. Instead, subscription is moved from componentDidMount to componentWillMount.

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