This file contains hidden or 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 sinon from 'sinon'; | |
import {assert, expect } from 'chai' | |
import React, { Component, PropTypes } from 'react | |
class JumperComp extends Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { |
This file contains hidden or 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 { Component } from React; | |
import { withProps } form 'recompose' | |
conset HomeLink = withProps({ href: '#/'})('a'); | |
conset ProductLink = withProps({ href: '#/producsts'})('a'); | |
const App = () => | |
<div> | |
<HomeLink>Homo Logo </HomeLink> |
This file contains hidden or 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
{ | |
"name": "react-hello-world", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "node server.js", | |
"build": "cross-env BABEL_ENV=production ./node_modules/.bin/webpack --config webpack.config.production.js", | |
"lint": "eslint --cache --ignore-path .gitignore --format=node_modules/eslint-formatter-pretty . *.js", | |
"test": "npm run lint" |
This file contains hidden or 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
// you need node server running with webpack middle ware | |
// simple server with webpack middle ware can be found here | |
// https://gist.github.com/neroze/083bb4355cffbb593696178c3adef256 | |
// Basic package.json for reactjs Development kick start | |
// https://gist.github.com/neroze/63c77d9e62226b60f61371df4abada6d | |
var webpack = require('webpack'); | |
var path = require('path'); | |
var WebpackBuildNotifierPlugin = require('webpack-build-notifier'); |
This file contains hidden or 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
const webpack = require('webpack'); | |
const WebpackDevServer = require('webpack-dev-server'); | |
const config = require('./webpack.config'); | |
new WebpackDevServer(webpack(config), { | |
publicPath: config.output.publicPath, | |
hot: true, | |
historyApiFallback: true | |
}).listen(5050, 'localhost', (err) => { | |
if (err) { |
This file contains hidden or 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 { Component } = React; | |
import { compose, lifecycle, branch, renderComponent, withState } from 'recompose'; | |
function fetchData(){ | |
return new Promise((resolve) => { | |
setTimeout(() => resolve({ | |
name: 'superman ', |
This file contains hidden or 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'; | |
import { | |
compose, | |
setDisplayName, | |
setPropTypes, | |
withState, | |
withHandlers | |
} from 'recompose' | |
const {Component} = React; |
This file contains hidden or 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'; | |
import { | |
compose, | |
setDisplayName, | |
setPropTypes, | |
withState, | |
withHandlers, | |
lifecycle, | |
mapProps |
This file contains hidden or 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
const mapStateToProps = (state) => ({ user: state.user }); | |
const User = connect(mapStateToProps)(({ user }) => | |
<div className="User" > { user.name } - { user.status } </div> | |
); | |
const App = () => | |
<div className="App"> | |
<User /> | |
</div> |
This file contains hidden or 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
// simple first class function | |
var fire = (name) => { | |
console.log(name) | |
} | |
// A new high order function which accepts another function as its parameter and | |
// calls another function with parameter which will be again passed on to high other order function as its parameter | |
var fireman = (method) => (firingObject) => { | |
method(firingObject) |