Skip to content

Instantly share code, notes, and snippets.

View eduard-tkv's full-sized avatar

Eduard eduard-tkv

  • Toronto, Canada
View GitHub Profile
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
//using ES6
import React from 'react';
class App extends React.Component {
constructor(props) {
super(props)
this.handleClick = this.handleClick.bind(this)
}
// index.js
import App from './components/App';
ReactDOM.render(
<BrowserRouter>
<App store={store} />
</BrowserRouter>, document.getElementById('app'));
// App.js
import SubmitListing from './SubmitListing';
//components/CountWidget.js
import React from 'react';
let CountWidget = ({count, handleClick})=>{
return(
<div>
<p>Count: {count}</p>
<button onClick={handleClick}>Increment</button>
</div>
)
//App.js
import React, { Component } from 'react';
import {incrementCount} from '../actions';
export default class App extends React.Component {
constructor(props){
super(props);
this.state = {
//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
});
//constants/app-constants.js
let constants = {
INCREMENT: "INCREMENT"
};
export default constants;
//dispatcher/dispatcher.js
import {Dispatcher} from 'flux';
let HigherOrderComp = (Component) => class extends React.Component{
construstor(props){
super(props);
this.state = {
count: 0
};
}
componentDidMount(){
setInterval(()=>{
import React from 'react';
const STATUS = {
HOVERED: 'hovered',
NORMAL: 'normal',
};
export default class Link extends React.Component {
constructor(props) {
class Detail extends React.Component{
constructor(props){
super(props);
this.state = {
commits: [],
mode: "commits",
forks: [],
pulls: []