Simple React JS Skeleton with simple route and component currently just for view only, next update will can be connect to API / Database.
Follow this step to use or install the skeleton :
- Install Node JS from official website https://nodejs.org/en/
- Open
CMD
orTerminal
- Go to
htdocs
orwww
folder - Install
Gulp
with Node JS just runnpm install -g gulp
- Clone this repo
git clone https://github.com/muhibbudins/simple-react-skeleton.git
- Go to folder
simple-react-skeleton
- Run
npm install
- Finally run
gulp
- Open browser with URL http://localhost/simple-react-skeleton/
This skeleton including React, React Router, React DOM, jQuery and Bootstrap.
Include all component inside autoload.js
using ES6 syntax import
import Home from './Component/Home';
import Search from './Component/Search';
import About from './Component/About';
import Github from './Component/Github';
import NotFound from './Component/NotFound';
You can see route inside autoload.js
ReactDom.render(
<Router history={hashHistory}>
<Route path="/" component={Home}/>
<Route path="/search" component={Search}/>
<Route path="/about" component={About}/>
<Route path="/github" component={Github}/>
<Route path="*" component={NotFound}/>
</Router>,
document.getElementById('app')
);
Sample for simple component syntax.
"use strict";
// Include React
import React from 'react';
// Include another component like directive
import Navbar from '../Directive/Navbar';
module.exports = React.createClass({
componentWillMount() {
// When component will be mount
},
componentDidMount() {
// When component in mount process
},
componentWillUnmount() {
// When component will be unmount / destroy
},
render : function() {
return (
<div className="app">
<Navbar/>
<div className="row">
<div className="col-md-12">
Hello World!
</div>
</div>
</div>
);
}
});
- 9/17/2016 : Initial project just view skeleton
This project under MIT License