Skip to content

Instantly share code, notes, and snippets.

View zedd45's full-sized avatar
๐Ÿ˜
I may be slow to respond.

Chris Keen zedd45

๐Ÿ˜
I may be slow to respond.
View GitHub Profile
@zedd45
zedd45 / event-creator.spec.js
Created June 27, 2016 20:47
Karma + Webpack + fetch-mock
import configureMockStore from 'redux-mock-store';
import * from '../actions';
// must come before fetch-mock
import 'isomorphic-fetch';
import fetchMock from 'fetch-mock';
import thunk from 'redux-thunk';
const expect = chai.expect;
const fixtureData = require('aFixtureFile');
const mock = fetchMock.mock;
@zedd45
zedd45 / EventTable.jsx
Last active August 25, 2016 22:02
Redux: cannot read displayName of undefined (Redux + Karma Webpack)
import React from 'react';
import { connect } from 'react-redux';
import EventTableComponent from './EventTableComponent';
import { fetchData } from '../../actions';
const mapStateToProps = (state, ownProps) => {
return {
@zedd45
zedd45 / failureToConnect.md
Last active November 28, 2016 20:05
What we have here, is a failure to communicate

If you ever get errors about wrapWithConnect taking a null or undefined component, itโ€™s because you forgot to wrap the component.

Here's the error message I got, for convienence / reference:

wrapWithConnect(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.

wrong:

@zedd45
zedd45 / react-redux.md
Last active June 24, 2017 18:29
React + Redux Clarification

Discussion with a mentoree / pupil of mine about how React Redux works

React (view) lives separately from Redux (data management).

bingo

In order for react-redux to communicate to each other there needs to be a connector { connect } from react-redux.

There are ways around this, perhaps, but bingo again (you could write your own connect, like apollo did, but it just ties in with Redux, anyway ๐Ÿ˜› piggyback

@zedd45
zedd45 / branch.fish
Created June 6, 2018 14:20
fish function for common git workflow
function branch
git stash save "saving temporary state of branch $argv"
git checkout $argv
git branch -u origin/develop
git stash pop
end