Typing a dynamic tag in React with TypeScript?

Posted by Prem Tiwari | Updated on

Typing a dynamic tag in React with TypeScript. You can pass in a string as a tag name and use that as you have, but you need to type it properly to get type checking to work. tag should be a key of JSX.IntrinsicElements.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers