Explorar o código

Step 9.7: Wrap new task form to only show when logged in.

Frederic G. MARAND %!s(int64=8) %!d(string=hai) anos
pai
achega
528904b319
Modificáronse 1 ficheiros con 5 adicións e 3 borrados
  1. 5 3
      App.jsx

+ 5 - 3
App.jsx

@@ -80,10 +80,12 @@ App = React.createClass({
           <AccountsUIWrapper />
 
           {/* These are JSX comments. */}
-          {/* Beware: for React, onsubmit is not the same as onSubmit, the former doesn't work */}
-          <form className="new-task" onSubmit={this.handleSubmit} >
+          { this.data.currentUser ?
+            // Beware: for React, onsubmit is not the same as onSubmit, the former doesn't work.
+            <form className="new-task" onSubmit={this.handleSubmit} >
             <input type="text" ref="textInput" placeholder="Type to add new tasks" />
-            </form>
+            </form> : ''
+          }
           </header>
 
         <ul>