Which of the following is true about the state in ReactJS?

DC-302-Midterm-Quiz

Quiz
•
Computers
•
University
•
Medium
Ian Claros
Used 1+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
State is immutable and cannot be changed after being set.
State can only be used in functional components.
State can hold data that may change over time and affect the rendering of the component.
State is used to pass data from a parent component to a child component.
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is true about ReactJS components?
A component can return multiple elements without wrapping them in a single container.
Components in React can only be class-based.
A React component must be written in JavaScript and cannot use JSX.
Functional components can use hooks like useState and useEffect to manage state and side effects.
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which statement is true about props in ReactJS?
Props are mutable and can be changed within the component that receives them.
Props are used to pass data from a child component to a parent component.
Props can be passed to components to allow them to be reused with different inputs.
Props are used to manage the internal state of a component.
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the correct way to create a functional component in ReactJS?
function Component { return ( <h1>Hello World!</h1> ); }
function Component() { return ( <h1>Hello World!</h1> ); }
const Component = function() { return <h1>Hello World!</h1>; }
const Component = () => { <h1>Hello World!</h1>; }
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is the correct way to initialize and update state in a functional component using React Hooks?
const [count, setCount] = this.state(0);
const count = useState(0); setCount(count + 1);
const [count, setCount] = useState(0); setCount(count + 1);
this.state = { count: 0 }; setCount(count + 1);
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following correctly uses props in a functional React component?
function Greeting(props) { return <h1>Welcome, {props.name}!</h1>; }
function Greeting() { return <h1>Welcome, props.name!</h1>; }
function Greeting(props) { return <h1>Welcome, this.props.name!</h1>; }
function Greeting(props) { return <h1>Welcome, {name}!</h1>; }
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is the correct way to handle an event in a ReactJS functional component?
<button onclick="handleClick()">Click me</button>
<button onClick={handleClick()}>Click me</button>
<button onClick={handleClick}>Click me</button>
<button OnClick={handleClick}>Click me</button>
Create a free account and access millions of resources
Similar Resources on Quizizz
20 questions
Examen 1P DAND 23

Quiz
•
University
20 questions
LATIHAN DASAR HTML

Quiz
•
KG - University
10 questions
Lecture 3

Quiz
•
University
11 questions
HTML Basics

Quiz
•
University
10 questions
Html/Css Quiz Day 1

Quiz
•
University
11 questions
CSS Basics

Quiz
•
University
10 questions
CSS-каскад стиль

Quiz
•
University
15 questions
Web Technology

Quiz
•
University
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
20 questions
Math Review - Grade 6

Quiz
•
6th Grade
20 questions
math review

Quiz
•
4th Grade
5 questions
capitalization in sentences

Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance

Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions

Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines

Quiz
•
Professional Development
12 questions
Dividing Fractions

Quiz
•
6th Grade