3. component and function
// ES5
var MyComponent = React.createClass({
render: function() {
return(
<h3>Hello JavaTpoint</h3>
);
}
});
// ES6
class MyComponent extends React.Component {
render() {
return(
<h3>Hello Javatpoint</h3>
);
}
}
👍4
4. props
// ES5
var App = React.createClass({
propTypes: { name: React.PropTypes.string },
render: function() {
return(
<h3>Hello, {this.props.name}!</h3>
);
}
});
// ES6
class App extends React.Component {
render() {
return(
<h3>Hello, {this.props.name}!</h3>
);
}
}
❤5
🔰 Objects as Structs in JavaScript
This flexibility allows for a wide range of programming styles, including object-oriented programming.
While JavaScript does not have a direct equivalent to structs, its objects can be used in similar ways to group related data and behavior.
This flexibility allows for a wide range of programming styles, including object-oriented programming.
👍5❤2🔥2
🧿 ReactJS Cheat-Sheet
This Post includes a ReactJs cheat sheet to make it easy for our followers to work with Reactjs.
👍11