I hereby claim:
- I am erikras on github.
- I am erikras (https://keybase.io/erikras) on keybase.
- I have a public key ASBKqAeWHhNv0eDi5m-_tjdje5Adf8HqJnK2FROuaIbdago
To claim this, I am signing this object:
componentWillReceiveProps(nextProps) { | |
if(!this.props.deadDrop && nextProps.deadDrop) { | |
// dispatch an action to clear the value | |
this.props.clearDeadDrop() | |
// do what your case officer has instructed, Agent | |
this.performOperation(nextProps.deadDrop) | |
} | |
} |
/** | |
* Answer to https://stackoverflow.com/questions/40349005/how-to-initialize-a-fieldarray-from-state-using-redux-form | |
* | |
* How to run: | |
* | |
* 1) Clone redux-form repo | |
* 2) Run the Initialize From State example (https://github.com/erikras/redux-form/tree/master/examples/initializeFromState) | |
* 3) Replace InitializeFromStateForm.js with this file | |
* 4) ... | |
* 5) Profit! |
import React, { Component, PropTypes } from 'react' | |
class RichTextMarkdown extends Component { | |
static propTypes = { | |
input: PropTypes.shape({ | |
onChange: PropTypes.func.isRequired, | |
value: PropTypes.string | |
}).isRequired | |
} |
I hereby claim:
To claim this, I am signing this object:
/* | |
* As I have been migrating a project from redux-form v5 to v6, I have come across this useful pattern. | |
* | |
* I have many such "custom inputs and errors beside them" structures around my app. | |
*/ | |
// v5 code | |
<div> | |
<MyCustomInputThing | |
{...myField} |
v6.2.2 | |
3.9.5 | |
[email protected] /Users/erik/oss/redux-form | |
βββ [email protected] | |
βββ¬ [email protected] | |
β βββ¬ [email protected] | |
β β βββ [email protected] | |
β βββ [email protected] | |
β βββ¬ [email protected] | |
β β βββ¬ [email protected] |
import React, { Component, PropTypes } from 'react' | |
import { withRouter } from 'react-router' | |
import queryString from 'query-string' | |
@withRouter | |
export default class SearchBox extends Component { | |
static propTypes = { | |
router: PropTypes.object.isRequired | |
} |
import React, { Component } from 'react' | |
import MyWrappedComponent from './MyWrappedComponent' | |
export default class MyContainer extends Component { | |
constructor() { | |
// bind handlers | |
this.handleCallback = this.handleCallback.bind(this) | |
} | |
handleCallback(load, save, clear) { |
import React, { Component } from 'react' | |
import MyWrappedComponent from './MyWrappedComponent' | |
export default class MyContainer extends Component { | |
constructor() { | |
// bind handlers | |
this.handleLoad = this.handleLoad.bind(this) | |
this.handleSave = this.handleSave.bind(this) | |
this.handleClear = this.handleClear.bind(this) | |
} |
const startTime = Date.now(); | |
function generatePermutations(dictionary) { | |
const results = []; | |
const permute = (array, position) => { | |
if (position === array.length - 1) { | |
results.push(array); | |
} else { | |
for (let i = position; i < array.length; i++) { | |
const swap = array[position]; | |
array.splice(position, 1, array[i]); |