I
I
Iliaity2016-02-18 01:38:22
JavaScript
Iliaity, 2016-02-18 01:38:22

Why is null needed in these examples?

I started reading books on react. And in all examples, the author passes null as an argument. What for ?

var Component = React.createClass({
  render: function() {
    return React.DOM.span(null, "I'm so custom");
  }
});

React.render(
  React.createElement(Component),
  document.getElementById("app")
);

var Component = React.createClass({
  render: function() {
    return React.DOM.span(null, "My name is " + this.props.name);
  }
});
React.render(
  React.createElement(Component, {
    name: "Bob"
  }),
  document.getElementById("app")
);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Gushchin, 2016-02-18
@Iliaity

This is the props of the component.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question