0
16
JRJose Romero
reactstateuseStateβ’β’β’
React TypeScript RecipesCreates a new instance of the useState
function, with the initial value of undefined
. The useState
function returns an object with two properties, value, which is an object containing the current value of the state, and setValue, which is a function that sets the value of the state to the provided argument.
Library: react
Shortcut: react.hook.state.use
import { useState } from 'react';
const [value, setValue] = useState<Type>(undefined);