Update nextjs.md (#2998)

* Update nextjs.md

add mandatory argument for useRef

* Update testing.md

added initialValue for useRef
This commit is contained in:
Mohit Tokas 2025-02-08 17:19:57 +05:30 committed by GitHub
parent c96cf83663
commit 57608bbbdf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -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())
}

View File

@ -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()
}