reactjs - Flux architecture for a login or basically most forms processing -
i trying understand bit more flux architecture , designing simple login component. suppose when login (post ajax) , error comes back. how information flow in flux?
- i think logincomponent should work on handlesubmit function.
- after ajax call comes error , message should component create action such "updateloginstatus payload {message: "no e-mail found"}. trigger loginstore or save status message , emit event such "loginstatusmessagechanged".
- another totally different component called loginstatusmessage register listen events on loginstore. notified of event , proceede update it's own state message. go out loginstore , fetch message , display user via render.
i believe example covere question quite well: https://github.com/przeor/react-router-flux-starter-kit/
Comments
Post a Comment