This file contains 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 ReactDOM from "react-dom" | |
export default class Calculator extends React.Component{ | |
constructor(props) { | |
super(props); | |
this.state = {output: ""}; | |
} | |
render(){ |
This file contains 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
//compose from redux/compose.js | |
function compose(...funcs) { | |
console.info("$$$ compose function ") | |
console.dir( funcs) | |
if (funcs.length === 0) { | |
return arg => arg | |
} | |
if (funcs.length === 1) { | |
return funcs[0] |
This file contains 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
// createThunkMiddleware from redux-thunk.js | |
export function createThunkMiddleware(extraArgument) { | |
return function thunkFunction ({ dispatch, getState }) { | |
return function nextFunction (next) { | |
console.info("In next function") | |
console.dir(next) | |
return function actionFunction (action) { | |
console.info("action RETURNED") | |
console.dir(action) | |
This file contains 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 {takeEvery,delay} from 'redux-saga' | |
import {call, put, take} from 'redux-saga/effects' | |
import {asyncTestInitial,asyncTestSaga,asyncFetchInitial, | |
asyncFetchSuccess,asyncFetchError} from '../actions/middlewareActions' | |
export function FetchTestData(){ | |
return fetch('testdata.json') | |
.then((res)=> res.json()) | |
.then((jsondata)=> { |
This file contains 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
//******************************************************************************************************* | |
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> ) | |
}) |
This file contains 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
//******************************************************************************************************* | |
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} /> ) | |
}) |
This file contains 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
********************************* | |
describe('>>>H O M E --- Shallow Render REACT COMPONENTS',()=>{ | |
let wrapper | |
const output = 10 | |
beforeEach(()=>{ | |
wrapper = shallow(<Home output={output}/>) | |
}) |
This file contains 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 { | |
GraphQLObjectType, | |
GraphQLNonNull, | |
GraphQLSchema, | |
GraphQLString, | |
GraphQLList, | |
GraphQLInt, | |
GraphQLBoolean | |
} from 'graphql/type'; |
This file contains 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 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'; |
This file contains 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 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'; |
NewerOlder