One feature that was part of ES6 release was the
Symbol data structure — but many developers are not aware of its use cases in application code. In this article, I am going to talk through a scenario where I felt
Symbol can be a best fit.
Recently, I was working on a feature where we had nested form components that need to be reset or validated from parent component. Initially, I thought of doing it by passing a boolean value as a prop to child components from parent component by setting it to true and then resetting it after the validation is complete to make it ready for the next iteration if we ever want to validate/reset the form again.
So, a simple pseudo code looks like this:
Triggering change detection to run validation in child component from parent component
In parent component, we are setting
validate value to
true first and then resetting it to
false . In child component, we are looking for the
validate value to run our validation logic. But as you notice, we have to reset
validate flag every time after we are done with the validation in order to run the validation afterwards.
So, why do we have to do that? The answer to this questions relates to how change detection runs. In react, like many modern frameworks, one of the ways the change detection process run is when a prop value changes in a component. If that value is a primitive type, it compares the previous value with current value where as in for objects, it checks the reference.
Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.
Have you ever thought of having your own app that runs smoothly over multiple platforms? React Native is an open-source cross-platform mobile application framework which is a great option to create mobile apps for both Android and iOS. **[Hire...
Hire dedicated React Native developers for your next project. As the top react native development company we offer you the best service as per your business needs.
Are you looking to [hire React JS developer](https://www.mobiwebtech.com/react-js-development-company/ "hire React JS developer") from a prestigious and reliable React JS development company? Visit at Mobiweb Technologies here we have a big team...
React Native is undoubtedly one of the most widely used cross-platform frameworks for creating native-like apps. This framework can be easily used for developing brand-new apps from scratch and even in existing iOS or Android projects.easily used for developing brand-new apps from scratch and even in existing iOS or Android projects.