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
Show hidden characters
{ | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"plugins": ["react", "import"], | |
"extends": ["eslint:recommended", "plugin:react/recommended", "plugin:import/errors","plugin:import/warnings"], | |
"parserOptions": { | |
"ecmaVersion": 6, |
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
var webpack = require("webpack"); | |
module.exports = { | |
entry: "./src/js/index.js", | |
output: { | |
path: "dist/assets", | |
filename: "bundle.js", | |
publicPath: "assets" | |
}, | |
devServer: { |
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_redux_template", | |
"version": "1.0.0", | |
"description": "A Template React and Redux", | |
"main": "./dist", | |
"scripts": { | |
"start": "./node_modules/.bin/webpack-dev-server", | |
"build": "weback", | |
"prod": "webpack -p" | |
}, |
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 UserList from '../containers/user-list'; | |
import UserDetails from '../containers/user-detail'; | |
import Nav from './Nav/Nav' | |
require('../../scss/style.scss'); | |
class Root extends React.Component { | |
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 throttle from 'lodash/throttle'; | |
export const loadState = () => { | |
try { | |
const serializedState = localStorage.getItem('state'); | |
if(serializedState === null) ? return undefined : return JSON.parse(serializedState) | |
} | |
catch(err) { | |
return undefined | |
}; |
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 { v4 } from 'node-uuid'; | |
*******EXAMPLE BELOW********** | |
export const addTodo = (text) => ({ | |
type: 'ADD_TODO', | |
id: v4() | |
}) |
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
/* preventing default behaviour */ | |
function ActionLink() { | |
function handleClick(e) { | |
e.preventDefault(); | |
console.log('The link was clicked.'); | |
} | |
return ( |
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
render() { | |
const isLoggedIn = this.state.isLoggedIn; | |
return ( | |
<div> | |
The user is <b>{isLoggedIn ? 'currently' : 'not'}</b> logged in. | |
</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
class FlavorForm extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = {value: 'coconut'}; | |
this.handleChange = this.handleChange.bind(this); | |
this.handleSubmit = this.handleSubmit.bind(this); | |
} | |
handleChange(event) { |
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 sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) | |
const asyncValidate = (values/*, dispatch */) => { | |
return sleep(1000) // simulate server latency | |
.then(() => { | |
if ([ '[email protected]', '[email protected]' ].includes(values.email)) { | |
throw { email: 'Email already Exists' } | |
} | |
}) | |
} |
OlderNewer