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
Make components stateless #33
Comments
It is hard to completely get rid of the lifecycle methods, as you probably will need them for some components. A better approach might be to make the distinction between smart and dumb components. |
@hampusohlsson that's a great link, thanks! How would you reflect that split in the application structure? |
Not really sure if this is good idea. As discussed above, getting rid of all the state and lifecycle methods is not easy and sometimes not necessary. (e.g. a Countdown component might need secondsLeft state, but parent components don't need to be aware this state) Separating "smart" and "dumb" component can be done putting them into different folders - "containers" for "smart" components and "components" for "dumb" components. |
👍 I really like that approach. What about pages - they are stateful components, but I feel like they should be in their own folder? I'm closing this issue in favor of #27, please comment there! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Remove all
class
es and make all components pure functions. E.g. turninto
Positives
setState()
, which is an anti-pattern anyway so we help to keep devs from using it. Since we're using Redux, everything should flow through a reducer.Negatives
Is the more explanation in the documentation worth it? I think so.
The text was updated successfully, but these errors were encountered: