Blog.

Building Up To React

Cover Image for Building Up To React
Bryan Guner
Bryan Guner
No date

Installing Node.js and NPM

When working with Node and React, you will need to use the command line. On the Mac, this is called the Terminal. On a PC, it is called the Command Prompt. Run the following commands to check your current version on node and npm. If needed, instructions on how to install or upgrade are below.

First, check to see if you have Node.js installed:

$ node -v

If this returns a version number, Node.js is installed. If the command is not found, you'll need to install Node.js from the Node.js website. Download the installer, run it, and follow the instructions.

Next, check your version of npm:

$ npm -v

Then, if you are running anything less than version 8, you will need to update npm:

Update npm on Mac

$ sudo npm update -g npm

Update npm on PC

Make sure to run the Command Prompt with administrator privileges:

$ npm update -g npm

Optionally install Yarn

Yarn is a package manager created at Facebook. It is a compatible alternative to npm. Yarn's use is not required, but you can optionally install it if you like:

$ sudo npm install -g yarn

Finally, there are some nice options for switching Node versions. This is not required, but you can optionally install one of these version mangers:

Installing the React Tools

Next, install the React developer tools:

Working with the Files

This repository links to samples hosted on various platforms, so that you can immediately begin interacting with the files. For smaller samples, we've linked to JSBins to allow you to run the sample with limited overhead. We also have links to CodeSandboxes and other repos if the samples are more in-depth.

React Resources

Finally, we have some links to resources and official documentation for the libraries that we will be using:

Examples:

<a class="jsbin-embed" href="https://jsbin.com/hopomod/1/embed?js,console">JS Bin on jsbin.com</a><script src="https://static.jsbin.com/js/embed.min.js?4.1.8"></script>

|

Pure React

If you take the time to understand what is going on behind the scenes you will be more efficient, especially when it comes time to debug.

Samples

Page Setup

  1. HTML Document Setup (code)
  2. HTML for a Recipe (run it)

React Elements

  1. Rendering an Element (run it)
  2. Rendering an Element with Properties (run it)
  3. Rendering Lists (run it)
  4. Mapping over Elements (run it)
  5. Adding Keys (run it)

React Components

  1. Rendering createElement (run it)
  2. List Items as props (run it)

Comments:


    More Stories

    Cover Image for Save Content

    Save Content

    Bryan Guner
    Bryan Guner
    Cover Image for JavaScript Basics

    JavaScript Basics

    Bryan Guner
    Bryan Guner