When using typescript with react, I want to skip passing every single props especially native props for HTML like id, name, placeholder etc but I got error on my {...props}
I've extended my interface with InputHTMLAttributes so that typescript didn't check my props but it still got unresolved error
import React, { InputHTMLAttributes } from "react";
import "./styles.css";
interface MyComponentProps extends InputHTMLAttributes<HTMLInputElement> {
nonNativeProp: string;
props: object
}
const MyComponent: React.FC<MyComponentProps> = ({
nonNativeProp,
props
}) => {
return <input type="text" {..props} />;
};
export default function App() {
return (
<div className="App">
<MyComponent
nonNativeProp="abc"
placeholder="Name"
name="something"
id="myInput"
data-custom="custom-attr"
/>
</div>
);
}