Gathering detailed insights and metrics for react-context-hooks-store-v2
Gathering detailed insights and metrics for react-context-hooks-store-v2
Gathering detailed insights and metrics for react-context-hooks-store-v2
Gathering detailed insights and metrics for react-context-hooks-store-v2
A simple global store based on React Context and Hooks
npm install react-context-hooks-store-v2
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
4 Stars
21 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Jul 11, 2022
Latest Version
0.0.1
Package Id
react-context-hooks-store-v2@0.0.1
Unpacked Size
33.90 kB
Size
10.61 kB
File Count
34
NPM Version
6.14.4
Node Version
12.16.3
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A simple global store based on React Context and Hooks
1npm install react-context-hooks-store 2or 3yarn add react-context-hooks-store
1// reducers/common.js 2let initialState = { 3 theme: 'white' 4}; 5 6const reducer = (state = initialState, action) => { 7 const { type, payload } = action; 8 9 switch (type) { 10 case `common/${constants.ACTION_TYPE.UPDATE_STATE}`: 11 return { 12 ...state, 13 ...payload 14 }; 15 16 default: 17 return state; 18 } 19}; 20 21export default reducer
1// store.js 2import { Provider, connect, memoize, useStore, useDispatch, useDeepEffect, combineReducers } from 'react-context-hooks-store'; 3 4import common from './reducers/common'; 5import global from './reducers/global'; 6 7const rootReducer = combineReducers({ 8 global, 9 common 10}); 11 12export { Provider, connect, memoize, rootReducer, useStore, useDispatch, useDeepEffect, combineReducers }
1// src/index.js 2import { Provider, rootReducer } from './store.js'; 3 4const initialValue = {} 5 6<Provider rootReducer={rootReducer} initialValue={initialValue}> 7 <App /> 8</Provider>
1// src/pages/movie.js 2import { connect, memoize, useDeepEffect } from './store.js'; 3 4const Movie = ({ theme }) => { 5 useDeepEffect(() => { 6 }, [array, object]); 7 8 return ( 9 <div>{theme}</div> 10 ) 11} 12 13const mapState = ({ common: { theme } }) => ({ 14 theme 15}); 16 17// options 18const memoPropsAreEqual = (prevProps, nextProps) => { 19 if (nextProps.visible !== prevProps.visible) { 20 return false 21 } 22 23 return true 24}; 25 26export default connect(mapState)(memoize(Movie, memoPropsAreEqual))
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/21 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More