ES6 / ES2016 Notes

const or let

Before:
var abc = "something";
var pie = 3.14;

After:
let abc = "something";
const pie = 3.14;

Functions

Before:
var App = function() {}

After:
const App = () => {} // you either use const or let depending on your variable type

Example ES6 function

const SearchBar = () => {
  return <input />;
}

Classes

class SearchBar extends React.Component{
  render() {
    return <input />;
  }
}


export default SearchBar;




Comments

Popular posts from this blog

ReactJS Components

NPM