Skip to content

Instantly share code, notes, and snippets.

hi

em

function formDataFrom(obj: { [key: string]: string | number }) {
let formData = new FormData()
for (let key in obj) {
formData.append(key, String(obj[key]))
}
return formData
}
export default formDataFrom
let scrollEnhanced = (Inner) => {
return class ScrollEnhanced extends Component {
render () {
return <Inner {...this.props} {...scrollEnhancedStuff} />
}
}
}
// ... later
class A extends Component {
doSomething = async () => {
this.setState({pending: true})
try {
await doSomething()
} catch (err) {
} finally {
this.setState({pending: true})
return (state: State = defaultState, action: Action) => {
let { _persist, ...rest } = state || {}
let restState: State = rest
switch (action.type) {
case PERSIST:
if (state._persist) {
console.warn(
'redux-persist: unexpected _persist state before PERSIST action is handled. If you are doing hmr or code-splitting this may be a valid use case. Please open a ticket, requires further review.'
)

Drive Markdown is a strict subset of markdown supporting the following syntax:

name syntax example
bold **bold** bold
heading1 # heading # heading
heading(N<5) ### heading (N=3) ### heading
link [link](https://google.com) link
ordered list ab ab
unordered list ab ab

An h1 header

Paragraphs are separated by a blank line.

2nd paragraph. Italic, bold, and monospace. Itemized lists look like:

  • this one
  • that one
// time iterator (read: debounce)
if (timeIterator === null) {
timeIterator = setInterval(processNextReducer, debounce)
}
function flush () {
storesToProcess.forEeach(processNextReducer)
}
function processNextReducer () {
import { createTransform, getStoredState, purgeStoredState } from 'redux-persist'
import { autoRehydrate as baseAutoRehydrate, createPersistor as baseCreatePersistor, persistStore as basePersistStore }
export { createTransform, getStoredState, purgeStoredState }
import immutableConfig from './immutableConfig' // basically verbatim redux-persist-immutable-state but keys renamed: _stateInit, _stateGetter, ...
import stateReconciler from './stateReconciler'
// perhaps we should add some validation to make sure stateReconciler is not being overriden?
export const autoRehydrate = (config, ...args) => {
import {getStoredState, createPersistor, autoRehydrate } from 'redux-persist'
export async function bootstrap () {
let initialState
try {
initialState = await getStoredState()
} catch (err) {
initialState = {}
}