I'm making changes to an existing code base.
Below is a snippet of the code with details hidden:
class Config extends Component {
.
.
.
render() {
const { onSubmit, isConfigValid } = this.props;
return (
<Form>
.
.
.
</Form>
);
}
}
I need to change the <Form> component to a <Dialog> component and the implementation notes for this component give an example usage as:
render(
<Dialog>
.
.
.
</Dialog>, document.getElementById('root')
);
How do I incorporate this into the current format where there is a return within the render?
I have tried simply replacing the <Form> tags with <Dialog> tags but I don't know where to put the document.getElementById('root') and the Dialog box appears in the wrong position without this.
Any help appreciated!
Dialogcomponent. The example is using the dialog as the root component to ReactDOM.render(…)renderseems to be ReactDOM.render since that's where you specify the container to show the component.Dialogcomponent and return it whenever you need.document.getElementById('root'), where does that goReactDOM.render. If you have a standalone component then you don't need it (provided that you actually render the component in the first place)