Create a React Component help

Tell us what’s happening:

I am facing an error while executing this code. And the error is “The h1 header should contain the string Hello React!.” but I have already used a String in H1 tag. what is going wrong…?

I have also tried passing state to the h1 tag by storing string value in the state. but still its showing an error.

the challenge asked for 3 things… 1st is - The React component should return a div element. (completed)
2nd- The returned div should render an h1 header within it. (completed)

3rd- The h1 header should contain the string Hello React! (not completed)

Your code so far

class MyComponent extends React.Component {
  constructor(props) {
  render() {
    // change code below this line
        <h1>  'Hello React!  </h1>

    // change code above this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:

I did mine the same as yours but without extra spaces and it worked. Try removing the spaces before and after the hello sentence.

<h1>  'Hello React!  </h1>

This is same as " 'Hello React! " when treated as literal string. It is true the string still contains "Hello React!", but it seems like the test is requires the exact match.

But why does those extra space matters…?

Its just typing mistake , I wrote exact match but still it doesn’t seems too work.

pls post your newest code. The extra spaces matter because the checking program is written by a human being and sometimes makes mistakes.

Thank You so much for the help, It worked…

1 Like