I need a reusable component with any markup type decided inside at the coding time, so hardcoding different component would be a very complicating solution, so handling the markup using a function's style would be just awesome.
Here my sandbox:https://codesandbox.io/s/determined-clarke-gvrzv?fontsize=14
I would modify my html markup dynamically depending on a javascript variable, as following:
let markup= "li"
function App() {
return (
<div className="App">
<[markup]>Hello World</[markup]>
</div>
);
}
the console returns me:
Unexpected token
How handle this problem?
Thanks for any hint!