i am new to reactjs and i stuck with appending svg element to the div element.
What is that i want to implement? I have a div element created dynamically like below.
The svg
element in your example is a react component, so it can be rendered inside DOM elements with ReactDOM.render
, like that:
componentDidMount() {
ReactDOM.render( , this.element);
}
The ReactDOM.render
call does not necessarily have to be in the componentDidMount
handler, you can use it in whatever part of the lifecycle of the component you feel like, as long as this.element
is an initialized DOM element.