Answer the question
In order to leave comments, you need to log in
How to render a ReactJS component?
There are three components App.js First.js and Second.js
In App I declare and render how now when I press the button in First, replace it with <Second/>
?
Or is it not possible for an element to replace itself?
Is it possible to set State as an element in App and if possible, then an example if there is one?
Answer the question
In order to leave comments, you need to log in
So far, I got out of the situation in this way, but part of the question
Or is it impossible for an element to replace itself? still relevant
constructor(...args) {
super(...args);
this.state = {
form: <First/>
};
}
{this.state.form}
<Button onClick={() => this.setState({ form: <Second/> })} >Create a new Patient</Button>
Because the editor is just a View representation of the MVC model (as the description says, although for me react is more suitable for SAM), then for such purposes you need to use Flux / Redux / ... other :)
And from there choose the behavior model.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question