Skip to content

Instantly share code, notes, and snippets.

@Gethyl
Gethyl / package.json
Created December 20, 2016 03:41
IsomorphicReactReduxTodo
{
"name": "isomorphictodolist",
"version": "1.0.0",
"description": "Creating an isomorphic todolist using react-redux and express",
"main": "index.js",
"dependencies": {
"babel-cli": "^6.18.0",
"babel-core": "^6.14.0",
"babel-loader": "^6.2.5",
"babel-plugin-react-html-attrs": "^2.0.0",
@Gethyl
Gethyl / routes.js
Created December 20, 2016 05:45
route.js from IsomorphicReactRedux
import React from "react";
import { Route, IndexRoute} from "react-router";
import Layout from "./components/Layout";
import Index from "./components/Index";
import Help from "./components/Help/Help";
import NotFoundPage from "./components/NotFoundPage";
const routes = (
@Gethyl
Gethyl / AddTodo.jsx
Last active December 20, 2016 06:14
AddTodo component from IsomorphicReactReduxToDoList
import React from "react";
import ReactDOM from "react-dom";
import Redux from "redux";
import { connect} from "react-redux";
import {AddItem} from "../../Actions/ToDoActions";
import Grid from 'react-bootstrap/lib/Grid';
import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col';
export const AddItem = (item) => ({
type: "ADD_ITEM",
item: item
})
export const DeleteItem = (id) => ({
type: "DELETE_ITEM",
itemId: id
})
import React from "react";
import ReactDOM from "react-dom";
import {DeleteItem, EditIconClicked, EditItem, CompleteItem} from "../../Actions/ToDoActions";
import Redux from "redux";
import { connect} from "react-redux";
import Grid from 'react-bootstrap/lib/Grid';
import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col';
import ListGroup from 'react-bootstrap/lib/ListGroup';
import React from "react";
import ReactDOM from "react-dom";
import {DeleteItem, EditIconClicked, EditItem, CompleteItem} from "../../Actions/ToDoActions";
import Redux from "redux";
import { connect} from "react-redux";
import Grid from 'react-bootstrap/lib/Grid';
import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col';
import ListGroup from 'react-bootstrap/lib/ListGroup';
@Gethyl
Gethyl / schema.js
Created December 28, 2016 05:12
graphql schema
import {
GraphQLObjectType,
GraphQLNonNull,
GraphQLSchema,
GraphQLString,
GraphQLList,
GraphQLInt,
GraphQLBoolean
} from 'graphql/type';
@Gethyl
Gethyl / dumbHomeComponent.js
Created January 5, 2017 18:11
Dumb Component Home.js testing.
*********************************
describe('>>>H O M E --- Shallow Render REACT COMPONENTS',()=>{
let wrapper
const output = 10
beforeEach(()=>{
wrapper = shallow(<Home output={output}/>)
})
//*******************************************************************************************************
describe('>>>H O M E --- REACT-REDUX (Shallow + passing the {store} directly)',()=>{
const initialState = {output:100}
const mockStore = configureStore()
let store,container
beforeEach(()=>{
store = mockStore(initialState)
container = shallow(<ConnectedHome store={store} /> )
})
//*******************************************************************************************************
describe('>>>H O M E --- REACT-REDUX (Mount + wrapping in <Provider>)',()=>{
const initialState = {output:10}
const mockStore = configureStore()
let store,wrapper
beforeEach(()=>{
store = mockStore(initialState)
wrapper = mount( <Provider store={store}><ConnectedHome /></Provider> )
})