Michael J. Stokes | Learning React : The Setup, Creating Templates, Babel


Now it the time I must learn React! This has been kept off for years and I have let opportunities pass by all because of the lack of skill in the framework.

The setup wasn’t so difficult. There are many different ways to setup a React environment suitable to the developer’s needs. I want to explore all possible ways to create the React server.

Once I had everything setup, I created my first template using JSX (JavaScript XML). It all starts with
var template =

Hello World!

;. But that’s not how it’s done in React! The browser doesn’t read that type of code because it’s not setup that way to be read. That’s when Babel comes in. It’s compiled JavaScript for the browser to read JSX files.

Here is an example:

var template = react.createElement(
'p',
{id:'myID'},
'Hello World'
);

Then you declare the ‘myID’ element by this……

var appRoot = document.getElement('myID');

Then render the DOM by……

reactDOM.render(template, appRoot);

So far I understand the beginning and looking forward to what comes next during my Learning React series.



No Comments Yet

You can be the first to comment!


Leave a Comment






Previous Post : « | Next Post :