Skip to content

Instantly share code, notes, and snippets.

@amanjuneja3012
amanjuneja3012 / fieldJson.json
Created August 31, 2018 06:46
A configuration object for rendering an atomic form field
{
"assetPropertyType": "ASSET",
"staticPropertyId": 215,
"dataType": "STRING",
"name": "attachedVehicleNumber",
"assetCategoryId": 24,
"assetGroupId": 1,
"regex": null,
"isEditable": false,
"isMandatory": true,
@amanjuneja3012
amanjuneja3012 / fetchMultipleReducers.js
Created July 27, 2018 12:45
When use case required us to fetch from multiple reducer's
const profilemapState = (state) => ({
pilotUnavailabilityCount : state.get('pilotReducer').get('pilotUnavailabilityCount'),
...customMapState(state, 'profileReducer')
})
export const ProfileComp = connect(profilemapState, actions)(customPropsToJSIfNeeded(Profile));
@amanjuneja3012
amanjuneja3012 / fetchReducer.js
Created July 27, 2018 12:42
Code to reduce mapStateToProps function boilerplate
const mapStateToProps = (state) => ({ ...customMapState(state, 'IndentReducer') });
export default connect(mapStateToProps, actions)((customPropsToJSIfNeeded(Indent)));