@savks/react-helpers
Advanced tools
Comparing version 1.2.1 to 1.3.0
import { useContext } from 'react'; | ||
function useRequiredContext(context, name) { | ||
const payload = useContext(context); | ||
if (!payload) { | ||
if (payload === undefined) { | ||
const displayName = name ?? context.displayName; | ||
@@ -6,0 +6,0 @@ throw new Error(`Required${displayName ? ` "${displayName}" ` : ''}context not defined`); |
{ | ||
"name": "@savks/react-helpers", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "React helpers", | ||
@@ -31,2 +31,5 @@ "license": "MIT", | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"peerDependencies": { | ||
@@ -33,0 +36,0 @@ "@reduxjs/toolkit": "^1.8.1", |
Sorry, the diff of this file is not supported yet
18435