React JS Conditional statement

In react JS you’re allowed to have an in-line conditional statement within the render and return functions. Why do they not work when the Class is view?

If I wanted To use a conditional statement inside of the return function for two different views is that possible or not?

The code is as follows:


I do not get an error when executing it, but the page does not change when the code above is executed or when the state changes

Any help would be much appreciated is there a better way to do this or am I doing something wrong?

It is possible, make sure you use unique key property on each returned View

1 Like