MCPcopy Create free account
hub / github.com/primer/react / TextInput

Function TextInput

packages/react/src/hooks/__tests__/useControllableState.test.tsx:47–59  ·  view source on GitHub ↗
({onChange, value: controlledValue}: {onChange?: (value: string) => void; value?: string})

Source from the content-addressed store, hash-verified

45})
46
47function TextInput({onChange, value: controlledValue}: {onChange?: (value: string) => void; value?: string}) {
48 const [value, setValue] = useControllableState({
49 value: controlledValue,
50 defaultValue: '',
51 onChange,
52 })
53
54 function handleOnChange(event: React.ChangeEvent<HTMLInputElement>) {
55 setValue(event.target.value)
56 }
57
58 return <input data-testid="input" type="text" onChange={handleOnChange} value={value} />
59}
60
61function ControlledTextInput() {
62 const [value, setValue] = useState('')

Callers

nothing calls this directly

Calls 1

useControllableStateFunction · 0.90

Tested by

no test coverage detected