E
E
evilpython2019-10-11 20:23:15
JavaScript
evilpython, 2019-10-11 20:23:15

Rendering a component based on a condition?

Let's say there is a component that is inserted into the layout like this:

<div>
        <SomeComponent />
</div>

It is necessary that it be drawn, or not drawn, depending on the conditions.
if (условие) {
    ///отрисовался
} else {
    ///не отрисовался
}

Please advise on the implementation. The condition is written and works, but I can’t figure out how to push the component into the right place depending on the condition.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
y0u, 2019-10-11
@evilpython

https://ru.reactjs.org/docs/conditional-rendering.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question