0
0
React Nativemobile~5 mins

Custom components in React Native - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a custom component in React Native?
A custom component is a reusable piece of UI built by combining React Native elements or other components. It helps organize code and reuse UI parts easily.
Click to reveal answer
beginner
How do you create a simple functional custom component in React Native?
You create a function that returns JSX. For example: <br><pre>function MyButton() {<br>  return (<br>    <Button title="Click me" /> <br>  );<br>}</pre>
Click to reveal answer
beginner
Why use props in custom components?
Props let you pass data or settings into a component, so it can show different content or behave differently each time you use it.
Click to reveal answer
beginner
What is the benefit of breaking UI into custom components?
It makes your app easier to read, maintain, and test. You can reuse components in many places without rewriting code.
Click to reveal answer
beginner
How do you use a custom component inside another component?
You import or define the custom component, then use it like a tag in JSX. For example: <br><pre>&lt;MyButton /&gt;</pre>
Click to reveal answer
What does a React Native custom component return?
ADatabase queries
BPlain text only
CCSS styles
DJSX elements
How do you pass data to a custom component?
AUsing CSS classes
BUsing global variables
CUsing props
DUsing HTML attributes
Which of these is a correct way to define a custom component?
Avar MyComp = 5;
Bfunction MyComp() { return <View></View>; }
Cconst MyComp = 'Hello';
Dlet MyComp = true;
Why should you create custom components?
ATo reuse UI parts and keep code clean
BTo make the app slower
CTo avoid using props
DTo write more code
How do you include a custom component named MyButton in JSX?
A<MyButton />
B<mybutton />
C<button />
D<Mybutton />
Explain how to create and use a custom component in React Native.
Think about making a small reusable UI piece.
You got /4 concepts.
    Why is breaking your app UI into custom components helpful?
    Imagine building with Lego blocks.
    You got /4 concepts.