Use this
const [user, setUser] = useState<IUser>({name: 'Jon'});
More Related Contents:
- Line 0: Parsing error: Cannot read property ‘map’ of undefined
- React Hooks – Modified state not reflecting immediately
- React Hooks – Modified state not reflecting immediately
- is it possible to React.useState(() => {}) in React?
- Property ‘value’ does not exist on type ‘never’. when use useRef hook in mui
- PropTypes in a TypeScript React Application
- React-hooks. Can’t perform a React state update on an unmounted component
- How to use refs in React with Typescript
- React Hook : Send data from child to parent component
- In general is it better to use one or many useEffect hooks in a single component? [closed]
- React hooks useEffect only on update?
- Importing images in TypeScript React – “Cannot find module”
- Why React useState with functional update form is needed?
- How to type a page component with props in Next.js?
- React Hooks: how to wait for the data to be fetched before rendering
- What does the colon mean in Javascript after function?
- Attempted import error: ‘useHistory’ is not exported from ‘react-router-dom’
- React with Typescript — Generics while using React.forwardRef
- Is it possible to limit children to specific components using React with TypeScript?
- Field Array in React using formik
- useMemo vs. useEffect + useState
- Typescript React: Access component property types
- What is the expected return of `useEffect` used for?
- React and TypeScript—which types for an Axios response?
- ReactJS – prevState in the new useState React hook?
- React – Is useState ‘s setter function able to change?
- Which react hook to use with firestore onsnapshot?
- Typescript + React/Redux: Property “XXX” does not exist on type ‘IntrinsicAttributes & IntrinsicClassAttributes
- How do I window removeEventListener using React useEffect
- React Hook useEffect has a missing dependency: ‘list’