freeCodeCamp/curriculum/challenges/arabic/03-front-end-libraries/react/write-a-react-component-fro...

1.2 KiB

id title challengeType isRequired videoUrl localeTitle
5a24c314108439a4d4036168 Write a React Component from Scratch 6 false

Description

undefined

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'getUserInput => assert(getUserInput("index").replace(/\s/g, "").includes("classMyComponentextendsReact.Component{"), "There should be a React component called <code>MyComponent</code>.");'
  - text: ''
    testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); return mockedComponent.find("h1").text() === "My First React Component!"; })(), "<code>MyComponent</code> should contain an <code>h1</code> tag with text <code>My First React Component!</code> Case and punctuation matter.");'
  - text: ''
    testString: 'assert(document.getElementById("challenge-node").childNodes.length === 1, "<code>MyComponent</code> should render to the DOM.");'

Challenge Seed

// change code below this line

Solution

// solution required