Improve Productivity by Creating React Native Custom UI Components
Updated: Nov 20, 2019
Did you ever feel you are writing the same code again and again? Or did you ever want to improve the productivity in React Native development? Here I have a solution to those problems. The answer is creating custom UI components for React Native application development. The common mistake doing by the beginners and some experienced people is rewriting the same code often. The custom UI components will help to address this problem.
In this blog post, we are going to look at the CustomButton component. And you will notice how it is easy and useful to improve the development speed.
First, we have a code for the "CustomButton" component. In this code, we'll get the style details via props. In the second code, we are using the CustomButtom by importing the element. This approach helps to reduce the lines of code from 35 to 2. We can also use the "CustomButton" component in other components too. So we don't want to rewrite the code often. And the icing on the cake we can change the design of the button every time we use it.
Using Default Props
Default props help to improve the efficiency of the code. Customize the design that you want.
I hope this post is useful. Thanks for reading!