Skip to content

Instantly share code, notes, and snippets.

View neroze's full-sized avatar
🎯
Focusing

Jumper neroze

🎯
Focusing
View GitHub Profile
import sinon from 'sinon';
import {assert, expect } from 'chai'
import React, { Component, PropTypes } from 'react
class JumperComp extends Component {
constructor(props) {
super(props);
}
render() {
@neroze
neroze / with-props
Created June 21, 2017 04:54
With Props recomposr
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>
@neroze
neroze / basic-webpack-reactjs-package.json
Created June 21, 2017 04:32
Basic package.js boiler for reactjs kick start
{
"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"
@neroze
neroze / webpack-settings-with-hot-reload
Last active June 21, 2017 05:29
Web pack setting with hot reload
// 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');
@neroze
neroze / simple-node-server-with-webpack-middleware
Created June 21, 2017 04:29
Simple node server with webpack middleware
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) {
@neroze
neroze / lifecycle-compose-recompose
Last active June 20, 2017 11:39
Loading .. lifecycle compose recompose
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 ',
@neroze
neroze / with-withState-withHandlers
Created June 20, 2017 10:11
with-withState-withHandlers
import React from 'react';
import {
compose,
setDisplayName,
setPropTypes,
withState,
withHandlers
} from 'recompose'
const {Component} = React;
import React from 'react';
import {
compose,
setDisplayName,
setPropTypes,
withState,
withHandlers,
lifecycle,
mapProps
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>
@neroze
neroze / high-order-functions
Created June 20, 2017 08:14
Javascript High Order Functions
// 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)