When I first started to adapt typescript in react, I notice I can't using ...props, as typescript check every single prop that are passed in the components. It's great but it's also annoying, where I have to pass native props like id, name etc declaratively as props.
interface MyComponentProps {
name: string,
id: string,
placeholder: string
}
const MyComponent = ({
name,
id,
placeholder
}: MyComponentProps) => {
return <input type="text" placeholder={placeholder} name={name} id={id}/>
}
export default function App() {
return (
<div className="App">
<MyComponent placeholder="Name" name="something" id="myInput" />
</div>
);
}