Advice and wisdom from Brendan Baker, formerly of Greylock.
(He used to have pitchpatterns.com, which listed all of these, but that domain has since lapsed.)
Advice and wisdom from Brendan Baker, formerly of Greylock.
(He used to have pitchpatterns.com, which listed all of these, but that domain has since lapsed.)
import React from "react"; | |
import useMutableReducer from "./useMutableReducer"; | |
const reducer = (draft, action, state) => { | |
switch (action) { | |
case "increment": | |
draft.count++; | |
break; | |
case "decrement": | |
draft.count--; |
This is a quick guide of what you need to do to publish a react component for use by others. This guide is distilled from a conversation [0] on twitter. I will reference individual tweets, where appropriate (thereby shifting blame for incorrect advice from me to the authors :D)
// approach 1: define action object in the component | |
this.props.dispatch({ | |
type : "EDIT_ITEM_ATTRIBUTES", | |
payload : { | |
item : {itemID, itemType}, | |
newAttributes : newValue, | |
} | |
}); | |
// approach 2: use an action creator function |
Prediction as of 3/15/2019 JST:
Currently it for clent-side apps only. Not for universall (isomorphic) apps. Will add it soon
I'm using the promise middleware to dispatch actions like this: