I am getting this Typescript warning/error in my vs code editor for some prop-namings in React.
Props must be serializable for components in the "use client" entry file, "setShow" is invalid.ts(71007)
for example:
const ComponentName = ({ show, setShow }: IComponentName) => {
...
Component logic
...
}
In which, setShow
is a function to update the state, being passed from the parent
to the child
.
But the project gets built successfully.
why does TS throw warnings for some naming on the props? What is the problem with name setShow
as prop name? And How to make TS not to throw warning/error for these namings?