mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
Update nextjs.md (#2998)
* Update nextjs.md add mandatory argument for useRef * Update testing.md added initialValue for useRef
This commit is contained in:
parent
c96cf83663
commit
57608bbbdf
@ -124,7 +124,7 @@ export interface CounterStoreProviderProps {
|
||||
export const CounterStoreProvider = ({
|
||||
children,
|
||||
}: CounterStoreProviderProps) => {
|
||||
const storeRef = useRef<CounterStoreApi>()
|
||||
const storeRef = useRef<CounterStoreApi>(null)
|
||||
if (!storeRef.current) {
|
||||
storeRef.current = createCounterStore()
|
||||
}
|
||||
@ -217,7 +217,7 @@ export interface CounterStoreProviderProps {
|
||||
export const CounterStoreProvider = ({
|
||||
children,
|
||||
}: CounterStoreProviderProps) => {
|
||||
const storeRef = useRef<CounterStoreApi>()
|
||||
const storeRef = useRef<CounterStoreApi>(null)
|
||||
if (!storeRef.current) {
|
||||
storeRef.current = createCounterStore(initCounterStore())
|
||||
}
|
||||
|
||||
@ -348,7 +348,7 @@ export interface CounterStoreProviderProps {
|
||||
export const CounterStoreProvider = ({
|
||||
children,
|
||||
}: CounterStoreProviderProps) => {
|
||||
const counterStoreRef = useRef<CounterStoreApi>()
|
||||
const counterStoreRef = useRef<CounterStoreApi>(null)
|
||||
if (!counterStoreRef.current) {
|
||||
counterStoreRef.current = createCounterStore()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user