New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

context-api-dev-tools-extension

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

context-api-dev-tools-extension

Port for [Redux Dev Tools Extension](https://github.com/zalmoxisus/redux-devtools-extension) now using Context API

latest
Source
npmnpm
Version
1.1.1
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Remote Context API - DevTools Extension

Build npm version codecov Known Vulnerabilities

Port for Redux Dev Tools Extension now using Context API

npm install --save-dev-exact context-api-dev-tools-extension

Example Demo

Example using useReducer

Detailed example can be seen here

// Library
import useContextDevTools from 'context-api-dev-tools-extension';

export function TodosContextProvider({
  children
}: {
  children: React.ReactNode;
}) {
  // Define reducer
  const [todos, dispatch] = useReducer(todosReducer, initialState);
  
  // Initialize DevTools Extension
  const devTools = useContextDevTools(dispatch);
  
  // Update devtools to send updated state
  useEffect(() => {
    devTools.sendUpdatedState(todos);
  }, [todos, devTools]);
  
  // Mount provider with state context
  return (
    <TodosDispatchContext.Provider value={devTools.sendDispatch}>
     <TodosStateContext.Provider value={todos}>
      {children}
     </TodosStateContext.Provider>
    </TodosDispatchContext.Provider>
  );
}

Keywords

redux

FAQs

Package last updated on 18 Oct 2020

Did you know?

Socket

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