Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vistajess/461174c5a006df1ca095 to your computer and use it in GitHub Desktop.
Save vistajess/461174c5a006df1ca095 to your computer and use it in GitHub Desktop.
Basics
1.Constants for ActionTypes
2.Actions based on actiontype
3.Reducer depends on constant
4.Store from redux
5.Views with Provider redux
6.connect state to props with connect in react-redux
Async HTTP Request using Redux
1.crete an action and import `axios` or other HTTP Library. Actions must have request, success and error status
2. create a function and return a dispatch.
3. return an http request and then dispatch action or you may have a parameter as your payload
To import data from store to view
1.Import connect from react-redux
2.import bindActionCreators from redux to instantly dispatch action to reducers
3.create a function that returns an object , it contains your state then pass to the view as props
4. create dispatch function that returns an object, it contains the action then pass to the view as props
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment