Giter Club home page Giter Club logo

react-hello's Introduction

Hello World with React and Cloud 9

Make sure you have node version 8

$ nvm install 8
$ nvm use 8
$ node -v
Download the boilerplate using the BreatheCode CLI
$ npm i @breathecode/breathecode-cli -g
Download the boilerplate using the BreatheCode CLI
$ breathecode start:react -r
and install the npm package:
$ npm install

That is it!

Start coding your ReactJS application.

Note: If you ever want to manually install all of this read the MANUAL.md file.

How start coding?

Now you have an index.js that will start your javascript execution (like the window.onload).

Every time you save your source code (js & css files) you will have to re-build your bundle.
$ npm run build
Webpack will generate your bundle.js inside the public folder

Check that a public/bundle.js file has been created by Webpack. Read the output from the console that must be similar to this:

> [email protected] transpile-dev /home/ubuntu/workspace
> webpack --config webpack.config.js

Hash: 64f06c46f625967b3aeb
Version: webpack 3.8.1
Time: 99ms
    Asset     Size  Chunks             Chunk Names
bundle.js  2.52 kB       0  [emitted]  main
   [0] ./src/bundle.js 51 bytes {0} [built]
NOTE: You have to re-bundle every time yo update your JS or CSS/SASS files.

You are ready to go! You can commit & push to your new repository whenever you want.

REMEMBER:

The application flow starts at index.js, you have to import any other files or assets into app.js in order for webpack to include them in the bundle.

For example, inside index.js you can do:

window.onload = function(){
    console.log('hello world');
}

To include images, styles or any other type of file just use the import command:

    //This will include file.js into your bundle.
    import 'js/file2.js';
    
    //this will include the styles at index.scss to your bundle.
    import '../styles/index.scss';
  1. All your JS and CSS code must go inside the src/ directory, and webpack will automaticly bundle them and export them into the public folder.

  2. The HTML code must be inside public/index.html

react-hello's People

Contributors

alesanchezr avatar joeblackdandt avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.