Socket
Socket
Sign inDemoInstall

react-state-provider

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-state-provider

A simple util that provides a easy way to share state accross react component.


Version published
Weekly downloads
19
increased by137.5%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

react-state-provider

A simple util for sharing state accross your react component without using react's context.

Intstall using npm

npm install react-state-provider --save

For Usage see the example below

When to use:

lets say you have react dom tree like this <Component-A> <Component-B /> <Component-C /> <Component-D> <Component-E /> </Component-D> </Component-A>

Now "Component-B" have a button that set a name, you want to display that name in "Component-E".

One way to solve it by having shared state in Component-A and pass a callback method to Component-B. Then Component-B will call the callback with name that set a updated value of name in Component-A's state;

But this will be tough when we have deep nesting component that want to share a state with some other component via props.

To solve this in a easy way you can use this util.

Keywords

FAQs

Last updated on 09 Dec 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc