javascript - Implementing a stateless child component in React.js -


i trying implement stateless, react component, display directions (as text) in footer -- calling it, direction component. component intended included in other parent components, representing different pages, pass in necessary directions props rendered direction component.

// direction.js  'use strict';  var react = require('react');  var direction = react.createclass({      proptypes: {         directiontext: react.proptypes.string.isrequired     },      render: function() {         return (             <div classname="direction">                 <p classname="direction-text">                     {this.props.directiontext}                 </p>             </div>         );     }  });  module.exports = direction; 


// controller.js var directioncontroller = {   // not sure how configure }; 

i not sure how should configure controller.

  1. do need controller, since component rendering text , doesn't handle user interactivity?

  2. is component supposed simple think is?

i new react.

you include direction component in render when need it, passing in property directiontext want display

render: function() {     <div classname="whatever-class">       <direction directiontext="some text show" />        <direction directiontext="some more more text text" />      </div> ) 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -