React: the problem ablout add a <Button> to <div>

Created on 10 Dec 2019  路  4Comments  路  Source: facebook/react

鎴睆2019-12-10涓嬪崍1 44 55
I am a novice . this is my code, i want to add this

All 4 comments

sorry if i missunderstand your question, but usually i do something like
`
const buttonComponent =

thank you very much, but You may not understand my problems, Simple, in other words,
i hava a button
const demoButton =

@ZhangTeng4070 it's solution your problem https://reactjs.org/docs/rendering-elements.html

Also you can call renderToString and you will get html markup your component https://reactjs.org/docs/react-dom-server.html#rendertostring

This looks like a fundamental misunderstanding. Assigning a JSX string to innerHTML is not how React components are meant to be used. You're meant to render the elements using e.g. ReactDOM.render() as shown in the docs.

Have you read through the intro docs yet? That might be helpful. Then if you have specific questions, you might try asking them :smile:

Going to close this issue for now, since I think I answered the question above.

Was this page helpful?
0 / 5 - 0 ratings