Sha256: 20ed82322f29e6ca30edc0158e46a36d8cdb7d455638a0722b30d159b7d8c482
Contents?: true
Size: 330 Bytes
Versions: 1
Compression:
Stored size: 330 Bytes
Contents
import { useState } from "react"; export default function useMaybeControlledValue<T>( initialValue: T, onChange?: (nextValue: T) => void ): [T, (nextValue: T) => void] { const [value, setValue] = useState(initialValue); if (onChange) { return [initialValue, onChange]; } else { return [value, setValue]; } }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.15.5 | app/javascript/components/RichTextArea/useMaybeControlledValue.ts |