What are the types of data that control a component?
What are the types of data that control a component?
In React Native, there are two primary types of data that control a component: props and state.
// Parent Component
function App() {
const fruits = { name: "Mango", color: "Yellow" };
return (
<div className="App">
<Fruit fruits={fruits} />
</div>
);
}
// Child Component
function Fruit(props) {
return (
<div className="fruit">
<h1>List of Fruits</h1>
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.