React Native component - View

View 

The View component act as a container in React Native. You can assume it is HTML 'div' in React Native. The most common way to write View is the same as div in React or JSX.




But it may be not always useful in React Native as 'div' is useful in web development. So you should understand its use cases. There are some major differences between 'div' and 'View'.


1. View is platform specific and renders differently on Android and iOS devices. It is because React Native uses Native components to render UI, whereas HTML and CSS are used to render Web pages.

2. Another difference between View and Div is its styling. We use JavaScript while styling components instead of CSS. We'll learn styling methods in another section.

3. React Native use Flexbox to layout whereas other way to layout div in HTML.

4. React Native provide built-in accessibility features. Which can help users to access apps for the person with disabilities.


In other ways, 'View' and 'div' may be similar. You may confident to go through the next component section.

Comments