Grokking React Native
Vote

0% completed

​

What are Props?

One component definition below produces two different profiles on the screen, because the parent gives each use of it different values:

import { View, Text } from 'react-native'; const UserProfile = (props) => { return ( <View> <Text>Name: {props.name}</Text> <Text>Age: {props.age}</Text> </View> ); }; const App = () => { return ( <View> <UserProfile name="John Doe" age={28} /> <UserProfile name="Jane Smith" age={25} /> </View> ); }; export default App;

The rendered text, from a run of this code, is:

Name: John Doe

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content