Font size
WorksheetsReact Initial Review
Total questions: 19
Worksheet time: 21mins
What is React?
A programming language used for web development
A javascript library for building user interfaces
A framework for creating mobile applications
A database management system
What is the command to start a react application?
(a)
pnpm create vite
yarn react-app
npm install react-app
npm react-app
What is JSX in React?
Is a JavaScript syntax extension that allows us to mix JS and HTML (XML)
A library of pre-written JavaScript code
A type of JavaScript syntax used to define React components
A programming language used to create web applications
Which of the following is a way to handle data in React.js?
(a)What is the method used in the main.tsx page in react to render the elements on the web page?
(a)
What is the purpose of the useState hook in React?
(a)What will the useState function return?
A string representing the current state of the component
An object containing the current state and a function to update the state
A function used to update the state
The current state value and a function to update the state
What's the magic formula for using the useState hook?
(a)useState(value)
UseState(value)
useState[value]
useState[value, setValue]
Can you use useState more than once in a React component?
No, it can only be used once per component
Yes, it can be used multiple times in a component
Can only be used more than once in class components
Depends on the size of the component
Can you use any value to initialize the state of the useState hook?
No, you can only use values of type string
No, you can only use numeric values
Yes, you can use any value
No, you can only use objects
What is the purpose of React Router DOM?
It helps in creating user interfaces.
It is used for routing in React applications
It is used for data fetching in React applications.
It is used for managing state in React applications.
What is the best way to navigate to a new route using React Router?
By manually updating the URL in the address bar.
By using the <Link> component to create a clickable link to the new route.
By using the history object to push a new route.
By using the <Redirect> component to redirect to the new route.
What is the correct implementation of a Route using React Router DOM?
<Route path="/" element={<Home />} />
<Route path="/" component={<Home />} />
<Route path="/" render={<Home />} />
<Route path="/" element={Home} />
How can you pass props to a component in React?
By using the <props> tag within the component
By using the <passProps> attribute within the component
By passing them as attributes in the component tag
By using the <props> attribute within the component
How do you install React Router DOM?
Using the command "npm or pnpm install react-router-dom"
Downloading it from the official website
Installing it from the React devtools
None of the above
How to declare a new useState?
Which of the following statements is true about using '?' for conditional rendering in React?
You can only use it to render simple expressions, not components
You can use it to conditionally render components or simple expressions
You can only use it to render components, not simple expressions
You cannot use it for conditional rendering in React
How can you use the ? operator to conditionally render one of two components in React?
condition ? <Component1 /> : <Component2 />
<Component1 ? condition : Component2 />
condition && <Component1 /> || <Component2 />
<Component1 || condition ? Component2 />
What is the purpose of useContext hook in React?
To use React's context API to pass data between components
To use React's Redux API to manage state in an application
To use React's Router API to handle navigation in an application
To use React's lifecycle methods in functional components
