Horrible Howtos: An ES6 React Component

disclaimer: nothing I do on this site is professionally done. I use this more as a tool for me to look back upon and use moving forward. As I gain more skills I may come back and make this easier for others to read and give sounder advice.

Today I want to learn how to create a base es6 markdown component. Since starting to learn react I have been confused as to what has changed in these components.

What I have learned is that we are simply using the extends declaration to take the Component class of React. You can learn more about react components and es6 here. In essence we are simply expanding the Component. Most of the rules still apply; however, visiting React's site you can learn more about subtle differences.

Here is a quick boilerplate for creating a new es6 component(and also how to declare state now).

import React, { Component } from 'react';
    export class myComponent extends Component {        
                	<h1>Make a Component!!</h1>

React has ditched the .createClass and allowed us to use pure functions more effectively in creation of our components!

Show Comments

Get the latest posts delivered right to your inbox.