Skip to content

ron813c/react-context-devtool

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Devtool for React Context

License: MIT NPM Download NPM

Installation

  1. Download extension from Chrome Web Store or Firefox addons store.

  2. Add _REACT_CONTEXT_DEVTOOL method in your Consumer.

<MyContext.Consumer>
  {
    values => {
      if (window._REACT_CONTEXT_DEVTOOL) {
        window._REACT_CONTEXT_DEVTOOL({ id: 'uniqContextId', displayName: 'Context Display Name', values });
      }
      return null;
    }
  }
</MyContext.Consumer>

Use with NPM package

  • Download and install npm package
npm install react-context-devtool
  • Add ContextDevTool component inside your Provider.
import ContextDevTool from 'react-context-devtool';

<MyContext.Provider value={{ a: 'hello', b: 'world' }}>
  // Add this in your context provider
  <ContextDevTool context={MyContext} id="uniqContextId" displayName="Context Display Name" />
  <YourComponent />
</MyContext.Provider>

License

MIT

Documentation managed by

About

React Context Devtool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 89.8%
  • HTML 10.2%