In the Chapter 2, Exploring JSX and ReactJS Anatomy, we talked a lot about ReactJS properties and used them throughout our examples, but so far, we've just used them like HTML properties. They play a role that is far beyond that. It's common to use them to pass data through your components tree that defines your view; to pass configuration properties that come from parent components; to pass callbacks for user input, UI/custom events that need to be triggered outside, and so on.
Properties of a ReactJS component can't be changed once the component is rendered in the DOM.
Properties define the declarative interface of the component. In a h1
element that renders a name property, for example, you can't change this name once it's rendered, unless you create another instance of the component and render it in the same place in the DOM, replacing the old rendered component.
var GreetingsComponent = React.createClass({ render: function() { return ( <h1>Hello...