A ZSH theme optimized for people who use:
- Solarized
- Git
- Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
For Mac users, I highly recommend iTerm 2 + Solarized Dark
By using ReturnType
we don't have to manually write type for Context
See also gist for SolidJS https://gist.github.com/JLarky/a46055f673a2cb021db1a34449e3be07
And original tweet https://twitter.com/JLarky/status/1554152932425117697
Also check Docker Learning Path and Lambda Learning Path
export const useSafeDispatch = dispatch => { | |
const mountedRef = React.useRef(false) | |
React.useLayoutEffect(() => { | |
mountedRef.current = true | |
return () => { | |
mountedRef.current = false | |
} | |
}, []) |
function asyncReducer(state, action) { | |
switch (action.type) { | |
case 'pending': { | |
return {...state, status: 'pending', data: null, error: null} | |
} | |
case 'resolved': { | |
return {...state, status: 'resolved', data: action.data, error: null} | |
} | |
case 'rejected': { | |
return {...state, status: 'rejected', data: null, error: action.error} |
export const apiWithLog = (init, options) => { | |
const end = timeSpan(); | |
return fetch(init, options).then(async (response) => { | |
const durationTime = end(); | |
const text = await response.text(); | |
let json; | |
try { |