Put if condition for return statement : tonightPlan


#1

I tried my code but it not allowed next pass, here is my code:

import React from 'react';
import ReactDOM from 'react-dom';

const fiftyFifty = Math.random() < 0.5;

// New component class starts here:
class TonightsPlan extends React.Component {
  render() {
    let planText;
    if (fiftyFifty) {
      planText= "Tonight I'm going out WOOO"
    } else {
       planText= "Tonight I'm going to bed WOOO"
    } 
   
   return <h1>Today I am going to {planText}!</h1>;  
  }
}

ReactDOM.render(
	<TonightsPlan />,
	document.getElementById('app')
);

return error


#2

from the instructions:
if fiftyFifty is true, then TonightsPlan should render this element:

<h1>Tonight I'm going out WOOO</h1>

If fiftyFifty is false, then TonightsPlan should render this element:

<h1>Tonight I'm going to bed WOOO</h1>

lets see what your function renders:

<h1>Today I am going to Tonight I'm going to bed WOOO!<h1>

that doesn’t look the same as asked by the lesson


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.