Search posts, tags, users, and pages
Ozzie Neher
Full Stack Dev
Something I had been struggling with since I started using React up until a few months ago was finding a good type to set for the children prop. The typical route I would take is to sorta just add the types as I needed them to a union like so: interf...
shadowtime2000
I program
You could also do
import type { PropsWithChildren } from "react";
because it's easier for build tools to know it's a type import so they can remove it without ruining the output of the code.
Interesting! I'd never heard of import type until your comment. The more ya know!
import type
typescriptlang.org/docs/handbook/release-notes/ty…
shadowtime2000
I program
You could also do
import type { PropsWithChildren } from "react";because it's easier for build tools to know it's a type import so they can remove it without ruining the output of the code.