O'Reilly logo

React Native Cookbook by Crysfel Villa, Stan Bershadskiy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a reusable button with theme support

Reusability is very important when developing software; we should avoid repeating the same thing over and over again, and instead we need to create small components that we can reuse as many times as needed.

In this recipe, we will create a button component, and we are also going to define several properties to change it's look and feel. While going through this recipe we will learn how to use props and how to dynamically apply different styles to a component.

Getting ready

We need to create an empty app using the React Native CLI, let's name it CustomComponents. Feel free to use any other name, just make sure to use the same name in step number 9.

How to do it...

  1. In an empty app, we need to create an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required