I'm doing an test here in my react application and I get a boolean as a parameter from an external object, by checking that boolean, I need to return a code snippet in my view.
This is my code that checks whether the value is true or false:
appInstance.get(myTest)
.then((value) => {
if (value.something === true) {
setContent
} else {
setAnotherContent
}
});
I must return in the same return different blocks according to my conditional above
return (
// if value.something === true, show this content
<h2>Title one</h2>
<p>Some text</p>
// else
<h2>Title two</h2>
<p>Some text two</p>
// a lot of code below that doesn't change
{...}
)
What is the best way to do this using react?