Created
September 22, 2015 08:06
-
-
Save jackcallister/c0bde27d42b2e05a1fb1 to your computer and use it in GitHub Desktop.
Validation Pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function mapPersonStateToProps(store) { | |
const validationErrors = personValidator(store.person.editableResource) | |
return { | |
validationErrors: validationErrors, | |
...restOfPropsFromStore | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function updatePersonProp(propName, propValue) { | |
return { | |
type: UPDATE_PERSON_PROP, | |
payload: {propName, propValue} | |
} | |
} | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const initialState = { | |
loading: true, | |
resource: {}, | |
editableResource: {}, | |
showSuccessMessage: false, | |
successMessage: 'Person updated successfully.', | |
error: false, | |
errorMessage: '', | |
updating: false | |
} | |
export default function person(state = initialState, action) { | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment