// This is really simple React Component.
// It has its own name (HelloWorld) it will be used for things like error display.
//
// Task: Render HTML span with "Hello World" text.
class HelloWorld extends React.Component {
// All components *must* have a `render` method defined.
//
// To define a component's render method, we use syntax called JSX. As you
// can see it looks similar to HTML. You can use normal JavaScript too, but
// JSX is much more popular, so we will stick to it. JSX gets converted to
// JavaScript code. It is here just for readability purposes.
//
// Note: You can read about `render` syntax here:
// https://facebook.github.io/react/docs/displaying-data.html
//
// Warning! JSX is not HTML - in the following lessons you will notice the differences.
//
// React delivers a big set of standard HTML elements like `div`, `p`,
// `canvas` etc. Here you can see usage of a `div` element.
render() {
return (
<div>FILL ME IN!</div>
);
}
}
// Note:
// You can use the official Google Chrome extension to browse all ReactJS
// components rendered on a single page. See the description here:
// https://facebook.github.io/react/blog/2014/01/02/react-chrome-developer-tools.html
/* Hello World tests DO NOT MODIFY LINES BELOW! */
mocha.setup('bdd');
describe("01 - HelloWorld", () => {
const assert = chai.assert;
var component;
beforeEach( () => {
var elem = document.createElement('div');
elem = document.body.appendChild(elem);
return component = React.render(React.createElement(HelloWorld), elem);
});
afterEach( () => {
React.unmountComponentAtNode(React.findDOMNode(component));
});
it("should complete all tasks", () => {
var divTags = React.addons.TestUtils.scryRenderedDOMComponentsWithTag(component, 'div');
var spanTags = React.addons.TestUtils.scryRenderedDOMComponentsWithTag(component, 'span');
assert.equal(divTags.length == 0, true, "Your React component shouldn't...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.