In the same way, theres an EditComponent: Now, the render method can look like the code below: Libraries like JSX Control Statements extend JSX to add conditional statements like the following: This library is actually a Babel plugin, so the above code is translated to the following: Alternately, the Choose tag is used for more complex conditional statements: The code above translates to the following: These libraries provide more advanced components, but if we need something like a simple ifelse, we can use a solution similar to Michael J. Ryans in the comments for this issue: Now that the save/edit functionality is encapsulated in two components, we can use enum objects to render one of them, depending on the state of the application. For example, the progress indicator and the heroes list both have to go somewhere. No problem. Change the name of the page property to see it in action. Activating extension 'vscode.typescript-language-features' failed: Could not find bundled tsserver.js. And is it genuinely readable? Learning Roadmap | Learn Vanilla JS So we can fill in variables, and even other components through functions, but sometimes more complex rendering logic is nec Conditional Rendering (Javascript) | by Samuel Guo | Medium I feel that this code follows a pattern that is reasonably repeatable, readable, and less error-prone than the other techniques. The differences here from rendering a single