I'm looking for a solution to efficiently add JSX attributes to multiple elements.
Here are the example attributes I want to include:
class?: string;
id?: string;
style?: string;
And here are the example elements:
namespace JSX {
interface IntrinsicElements {
element1: { att1: string; }
element2: { att2: string; }
element3: { att3: string; }
}
}
This is how I want them to behave:
namespace JSX {
interface IntrinsicElements {
element1: { att1: string; class?: string; id?: string; style?: string; }
element2: { att2: string; class?: string; id?: string; style?: string; }
element3: { att3: string; class?: string; id?: string; style?: string; }
}
}
Any suggestions on achieving this without repeating code?