We develop Web applications that use a variety of basic HTML elements, compare <div>,<span>, and more.
When we develop react native, we can't use HTML elements, but we can use a variety of components like
Html |
React Native |
Div |
View |
Img |
Image |
Span,p |
Text |
Although these elements have many similar uses, they are not equivalent. Let's get down to how these components run on the mobile side,
1. Text Components
Rendering text appears to be a basic feature that almost any application needs to render text. However, it is different from the normal text rendering of the web.
In react native, only the <Text> component can be a child of plain text, in other words, this is not valid:
< View > The text cannot be placed here </ View >
Instead, use the <Text> component to wrap the text content:
< View > < Text ></ Text > </ View >
Compare the differences between HTML elements and native components