diff --git a/tips/03-if-else-in-JSX.md b/tips/03-if-else-in-JSX.md index 5a04c9f6..91105b65 100644 --- a/tips/03-if-else-in-JSX.md +++ b/tips/03-if-else-in-JSX.md @@ -39,4 +39,25 @@ That's not valid JS. You probably want to make use of a ternary expression: React.renderComponent(
Hello World!
, mountNode); ``` +If a ternary expression isn't robust enough, you can use `if` statements to determine which +components should be used. + +```js +/** @jsx React.DOM */ + +var loginButton; +if (loggedIn) { + loginButton = ; +} else { + loginButton = ; +} + +return ( + +) +``` + Try using it today with the [JSX compiler](/react/jsx-compiler.html).