I hereby claim:
- I am whichsteveyp on github.
- I am steveyp (https://keybase.io/steveyp) on keybase.
- I have a public key ASA-vzQSWq8PKNfyfJCQt7tx1SOAqF5RVaKDRrTOGubYXAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
{ | |
"exclude": [ | |
"node_modules", | |
"**/*.js" | |
] | |
} |
import actionTypes from 'redux-resource'; | |
const createActionCreators = (options = {}) => { | |
const { crudType, resourceName } = options; | |
const uppercaseCrud = crudType ? crudType.toUpperCase() : ''; | |
const isValidCrudType = | |
uppercaseCrud === 'UPDATE' || uppercaseCrud === 'DELETE' || | |
uppercaseCrud === 'READ' || uppercaseCrud === 'CREATE'; |
import React from 'react'; | |
import Downshift from 'downshift'; | |
class Foo extends React.Component { | |
render() { | |
return <Downshift onChange={this.onChange}> | |
{(controls) => { | |
const {isOpen, inputValue, selectedItem, ...funcs} = controls; | |
return <div> |
/* | |
Currently, I use `readResources(...)` for two main reasons: | |
1. easy conformity from my API responses into the reducers in a "resourceful" way, | |
along with all the great `getStatus()` and `meta` and `lists` benefits that each | |
slice has | |
2. it also makes XHRs for me and updates the above automatically for me | |
An issue with this is any time I need to control my _own_ XHRs, I loose out on the |
import React from 'react'; | |
import Component from './Component.jsx'; | |
export default class App extends React.Component { | |
render() { | |
return <Component options={{ autoplay: true }}> | |
{(status, video) => { | |
// this error is being caught in the promise in component render, even though |
const API = ({ match, data }) => { | |
// this i left as is | |
const { params: { mod, header, environment } } = match; | |
const doc = data.api.find(doc => mod === doc.title.slug); | |
// don't mind the tern here as much, maybe would split the find to its own `validDocHeaderMatch` | |
const validHeader = doc && (header ? !!doc.headers.find(h => h.slug === header) : true ); | |
// this is my 😍 for conditional JSX thus far | |
return <Block> | |
{!doc && <Redirect to={`/${environment}`}/>} |
import B from './ComponentB-map.jsx'; | |
export default const A = React.creatClass({ | |
render() { | |
const { wrapperStyle, BStyleMap } = this.props.style; | |
// now you have to grok A's map, as well as B's map _and_ hope B has a map that supports the | |
// customization that you would want B to support when in this A context | |
return ( |
// parent A wants to show a list | |
<GetLastNImagesOfType type="jpg" numImages={10}> | |
{(images) => { | |
return images.map(image => <span>{image.name}</span>) | |
}} | |
</GetLastNImagesOfType> | |
// parent B wants to show the images themselves | |
<GetLastNImagesOfType type="jpg" numImages={10}> | |
{(images) => { |
// imports & variables, etc | |
ReactDOM.render( | |
<Localization messageBundle={{ foo: 'Welcome', bar: 'This is', baz: 'a website' }}> | |
<Provider store={Store}> | |
<Router history={history}> | |
<Route path="/" component={SomeParentRenderingGrandchildrenThatWantLocalizedStrings}> | |
</Router> | |
</Provider> | |
</Localization>, |