Skip to content

Some examples to explore the differenes between React Props, React Context API and Redux

License

Notifications You must be signed in to change notification settings

mathiasfk/context-vs-redux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Props vs Context API vs Redux

This project is intended to explore the usage of Context API and compare it to other ways of accomplishing the same result.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

Comparison

ContextAPI Redux
What is it? A way of passing data (values, states, functions) through the component tree without having to pass props down manually at every level. A library for managing and updating application state in a predictable and testable way.
What is it NOT? A state management system. Just a way of sharing global state.
When should you use it? - You need to share some global state across multiple components. - You need to share large amounts of global state across multiple components.
- The logic to update that state may be complex.
- The app has a medium or large-sized codebase, and might be worked on by many people.
- You need more sofisticated debug tools.
When should you NOT use it? - Only one or two components use it.
- Passing props would do the job just as fine.
- The components need to be reusable.
- Small applications with a only a few global states.
- All you need is just sharing global state.
What libs would you install? - React - React
- Redux
- React Redux
- React Toolkit (optional)
- React Devtools Extension (optional)

Sources

About

Some examples to explore the differenes between React Props, React Context API and Redux

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published