Skip to content

imranhsayed/redux-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redux-example.

git clone https://github.com/imranhsayed/redux-example

npm install

⚡ Development

npm run dev

❄️ Production

npm run build

🌱 Branch Details

  1. 🏬 1-basic-redux-store Basic Redux store without using React. Find all code in src/store.js
  2. 🏬 combine-multiple-reducers Example for multiple reducers
  3. :squirrel: 3-fetch-posts Redux Example to fetch Posts from https://jsonplaceholder.typicode.com/
  4. 🎒 asynchronous-actions-with-redux Handling asynchronous actions with redux
  5. 🎒redux-with-react Using Redux store for data in React Components

❄️ Steps to take

📦 Step 1 : INSTALL PACKAGES

npm i redux react-redux redux-thunk prop-types

📹 Step 2 : CREATE ACTIONS

-Create a directory called actions inside src -Create a file called types.js -Create an action file called postActions and add an action creator function to create an action -Each action creator is a function

🔮 Step 3 : CREATE REDUCERS

-Create a directory called reducers inside src -Create a file called postReducers.js inside src/reducers -Create a file called index.js inside src/reducers and combine your reducers

🏬 Step 4 : CREATE STORE

-A Store holds your application state. -create a file called store.js and create a store using createStore()

🏢 Step 5 : PASS STORE TO MAIN COMPONENT

-Wrap your App.js inside the Provider and pass store to it.

:octocat: Step 6 : CONNECT AND CALL ACTIONS

-Connect React with redux -Define proptypes -Map state to props -Call Actions ( this.props.fetchPosts() )

About

🌀 A redux example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published