Answer the question
In order to leave comments, you need to log in
How to pass html attribute to reactjs app?
There is a web application which has index.hml with the following code:
<body>
<div id="root" some-param="value"></div>
<script src="app.js"></script>
</body>
render(<App />, document.getElementById('root'));
Answer the question
In order to leave comments, you need to log in
var x = document.getElementById("root").getAttribute("some-param");
Perhaps someone else will need almost the same option with forwarding to props:
const root = document.getElementById('root');
render(<App {...(root.dataset)} />, root);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question