FormidableLabs / freactal

Clean and robust state management for React and React-like libs.
MIT License
1.65k stars 46 forks source link

Component life cycle #77

Closed GHEMID-Mohamed closed 7 years ago

GHEMID-Mohamed commented 7 years ago

Does components that you have used in documentation extend from React Component ? Because I can't set the componentWillMount() !

Jascha-Sundaresan commented 7 years ago

components written as functional stateless components don't have lifecycle hooks.

You'll need to do the class YourComponent extends React.Component... pattern for creating components that you want to have lifecycle hooks for.

Alternatively, you can use Recompose's lifecycle hoc.

Jascha-Sundaresan commented 7 years ago

Why do you need to use componentWillMount anyways? What do you need to accomplish that can't be done w/ the initialize effect?

GHEMID-Mohamed commented 7 years ago

@Jascha-Sundaresan Thank you I solved the problem with initialize effect, it's just that documentation is not clear enough, but I'm impressed with your way for managing states in react app :+1:
Continue to improve this library :+1:

Jascha-Sundaresan commented 7 years ago

can this be closed @HamadaBrest?

GHEMID-Mohamed commented 7 years ago

@Jascha-Sundaresan Yes of course :) thank you