-
Notifications
You must be signed in to change notification settings - Fork 1
Performant React Forms #1
base: master
Are you sure you want to change the base?
Conversation
nold2
commented
Dec 21, 2018
- Implemented Lazy load for the custom select fields
- Implemented React.memo for the custom select fields
- Added the appropriate proptypes and default props for the custom select fields
- Implemented React Suspense to lazy load the custom fields
- implemented componentDidMount LifeCycle to ensure a single trip to server to retrieve the Province data
- Implemented ComponentDidUpdate LifeCycle to ensure that once a province change, cities, districts and subdistricts will change as well same goes for other fields
So personally I like async await syntax better. Since it is shorter and less chaining But in this case I want to Since it is still an un-resolved promise I use the Is there a better pattern that you would like to see? Like another chain of .then(onSuccess, onFail) where onSuccess will do the setState? |
Well React.memo prevents any unwanted re-renders by doing a shallow comparision of the props. I was testing my code with React dev tools and noticed whenever I select an option other CustomSelect Components keeps on re-rendering. With React.memo, I was able to only re-render the selected component itself to display the value, and the CustomSelect below it to get the options. Not the whole CustomSelect component attached to the container |
Sure, having exact prop would be nice. i will add it |
…ovince, cities, districts and subdistricts, upon request, success and fail
…orm, form tag and button
…pts the validate prop from the helper function and customSelect now are able to display the error message if the user touches the field and did not passed the validation
Hi guys in this latest push, I managed to implement Redux(actions, actionTypes and reducer) and ReduxForm(form submission where output is displayed by console.log and form validation ). So no more It's getting late currently I really want to implement some features:
But so far this MR is working according to the requirement regarding efficient API fetch and redux, @vferdiansyah @onggunhao @kaiyuanneo @faisaldanacita Would this be enough for now? I don't mind adding/removing stuffs that are important Thank you |