export function useRef<T>(initial: T): { current: T }
Accepts the initial reference value.
import { afc, useForceUpdate, useRef } from 'react-afc' function Component(props) { const count = useRef(0) const text = useRef(null) const forceUpdate = useForceUpdate() function changeRefs() { count.current++ text.current = 'example' forceUpdate() } return () => <> <p>Count: {count.current}</p> <p>Text: {text.current}</p> <button onClick={changeRefs}> Change refs </button> </> } export default afc(Component)
There was an error while loading. Please reload this page.
Component
Lifecycle
State
Redux
Other