DEV Community

Mayank
Mayank

Posted on

Answer: Typing a dynamic tag in React with TypeScript?

JSX.IntrinsicElements no longer works with the new TypeScript version. It throws namespace JSX not found.

The solution is to use either ReactHTML from React or HTMLElementTagNameMap from lib.dom.d.ts (No need to import, works out of box).

So the full solution for allowing the HTML tags as well as React…

Top comments (0)

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay