Sometimes, we want to hide or show components in React Native.
In this article, we’ll look at how to hide or show components in React Native.
How to hide or show components in React Native?
To hide or show components in React Native, we can use the &&
operator.
For instance, we write
{
showInput && <TextInput />;
}
to show the TextInput
only when showInput
is true
.
showInput
can be a state or a prop.
When a state or prop changes, the component will re-render.
Conclusion
To hide or show components in React Native, we can use the &&
operator.