Next.js Discord

Discord Forum

Typescript good practise

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
  const [error, setError] = useState<null | string>(null);

sometimes i want to show error when it is something, is it good practise to say
null | string
. i am also interested, i have different errors should i create my type error in typescript or use already created interface Error

0 Replies