This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack') | |
var path = require('path') | |
var BUILD_DIR = path.resolve(__dirname + '/build') | |
var APP_DIR = path.resolve(__dirname + '/app') | |
var config = { | |
entry: ["babel-polyfill", APP_DIR + '/index.js'] | |
, output: { | |
path: BUILD_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//using ES6 | |
import React from 'react'; | |
class App extends React.Component { | |
constructor(props) { | |
super(props) | |
this.handleClick = this.handleClick.bind(this) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// index.js | |
import App from './components/App'; | |
ReactDOM.render( | |
<BrowserRouter> | |
<App store={store} /> | |
</BrowserRouter>, document.getElementById('app')); | |
// App.js | |
import SubmitListing from './SubmitListing'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//components/CountWidget.js | |
import React from 'react'; | |
let CountWidget = ({count, handleClick})=>{ | |
return( | |
<div> | |
<p>Count: {count}</p> | |
<button onClick={handleClick}>Increment</button> | |
</div> | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//App.js | |
import React, { Component } from 'react'; | |
import {incrementCount} from '../actions'; | |
export default class App extends React.Component { | |
constructor(props){ | |
super(props); | |
this.state = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//actions/app-actions.js | |
import constants from '../constants/app-constants'; | |
import dispatcher from '../dispatcher/dispatcher'; | |
export let incrementActions = { | |
incrementCount: ()=>{ | |
console.log('- inside incrementActions in app actions'); | |
dispatcher.dispatch({ | |
actionType: constants.INCREMENT | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//constants/app-constants.js | |
let constants = { | |
INCREMENT: "INCREMENT" | |
}; | |
export default constants; | |
//dispatcher/dispatcher.js | |
import {Dispatcher} from 'flux'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let HigherOrderComp = (Component) => class extends React.Component{ | |
construstor(props){ | |
super(props); | |
this.state = { | |
count: 0 | |
}; | |
} | |
componentDidMount(){ | |
setInterval(()=>{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
const STATUS = { | |
HOVERED: 'hovered', | |
NORMAL: 'normal', | |
}; | |
export default class Link extends React.Component { | |
constructor(props) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Detail extends React.Component{ | |
constructor(props){ | |
super(props); | |
this.state = { | |
commits: [], | |
mode: "commits", | |
forks: [], | |
pulls: [] |
NewerOlder