W
W
Wasya UK2017-09-19 14:54:36
JavaScript
Wasya UK, 2017-09-19 14:54:36

How to write in React?

I started learning react, but I don't know how to format the code better?

let Block1 = React.createClass({ // вариант №1
  render () {
    return <h2>Hello world! (1)</h2>;
  }
});

const Block2 = React.createClass({ // вариант №2
  render: () => <h2>Hello world! (2)</h2>
});

var Block3 = React.createClass({ // вариант №3
  render: function() {
    return <h2>Hello world! (3)</h2>;
  }
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
davidnum95, 2017-09-19
@dmc1989

throw away createClass and use ES6 classes here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question