ReactJS: List of Numbers with Index

This entry is part 6 of 35 in the series React JS

https://codepen.io/gaearon/pen/jrXYRR?editors=0011

function NumberList(props) {
  const numbers = props.numbers;
  const listItems = numbers.map((number) =>
    <li key={number.toString()}>
      {number}
    </li>
  );
  return (
    <ul>{listItems}</ul>
  );
}

const numbers = [1, 2, 3, 4, 5];
ReactDOM.render(
  <NumberList numbers={numbers} />,
  document.getElementById('root')
);

React For Beginners by Wes Bos

https://reactforbeginners.com/

premium step-by-step training course to get you building real world React.js + Firebase apps and website components.

Wes Bos is a Full Stack Developer, Speaker and Teacher from Canada. He works as an independent web developer and teaches as a lead instructor with HackerYou and Ladies Learning Code. Wes has taught over 500 students in 200+ classes and spoken at dozens of conferences around the world.

ReactJS radio button

This entry is part 3 of 35 in the series React JS

http://jsbin.com/mozegodapa/edit?html,js,console,output

class App extends React.Component {

  setFruit(event) {
    console.log(event.target.value);
  }

  render() {
    return (
      <div onChange={this.setFruit.bind(this)}>
        <input type="radio" value="Apple" name="fruit"/> Apple
        <input type="radio" value="Orange" name="fruit"/> Orange
      </div>
     )
  }
}

ReactDOM.render(<App/>, document.getElementById('app'));