I hereby claim:
- I am m1010j on github.
- I am m1010j (https://keybase.io/m1010j) on keybase.
- I have a public key ASBcVDMZPfmmd6wCTnnCUzSiNZ9tB42o4Mqu973FjdNyFwo
To claim this, I am signing this object:
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
const questionMachine = Machine( | |
{ | |
id: 'question', | |
initial: '47475c25-8e0f-4115-a55a-4dc643ae50a2', | |
context: { currentStep: 0, totalNumberOfSteps: 8, followupStep: 0 }, | |
states: { | |
complete: { type: 'final' }, | |
'47475c25-8e0f-4115-a55a-4dc643ae50a2': { | |
on: { ANSWER: [{ target: 'a8af0f85-fa49-4531-9223-39c7ce11af7a', actions: 'incrementCurrentStep' }] }, | |
}, |
const questionMachine = Machine( | |
{ | |
id: 'question', | |
initial: '47475c25-8e0f-4115-a55a-4dc643ae50a2', | |
context: { | |
currentStep: 1, | |
totalNumberOfSteps: 8, | |
}, | |
states: { | |
'47475c25-8e0f-4115-a55a-4dc643ae50a2': { |
const questionMachine = Machine( | |
{ | |
id: 'question', | |
initial: '072ecdc1-be12-4f8f-9707-15e4dd53ccc0', | |
context: { | |
currentStep: 0, | |
totalNumberOfSteps: 2, | |
followUpQuestionStep: 0, | |
}, | |
states: { |
I hereby claim:
To claim this, I am signing this object:
function RefHooksComponent(props) { | |
const ref = useRef(null); | |
if (ref.current === null) { | |
ref.current = expensiveCalculation(props.arg); | |
} | |
const result = ref.current; | |
// ... | |
} |
function FunctionHooksComponent(props) { | |
const [result] = useState(() => expensiveCalculation(props.arg)); | |
// ... | |
} |
function MemoHooksComponent(props) { | |
const { arg } = props; | |
const result = useMemo(() => expensiveCalculation(arg), [arg]); | |
// ... | |
} |
function NaiveHooksComponent(props) { | |
const [result] = useState(expensiveCalculation(props.arg)); | |
// ... | |
} |
class ClassComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { result: expensiveCalculation(this.props.arg) }; | |
} | |
// ... | |
} |