You are implementing a stateful component in your React project which will display the number of people living in your town. Which of the following React hooks should be used to update the state of the component?
setEffect()
useEffect()
setState()
useState()
What is the benefit of
useState
overuseReducer
?There is no benefit.
useReducer
is more performant.useState
is more performant.
What is the type of data which is passed from a parent component to a child component?
props
datastate data
mutable data
variable data
True or False: Uncontrolled components are components that do not maintain their own state.
True
False
Which React hook must be utilized when calling an API using the
fetch()
method?useEffect
useState
useReducer
Which data transfer format is most commonly used with APIs?
Text
XML
JSON
Which one of the following code snippets is a valid unit test?
unitTest("Validate title", () => { render(<App />); const actualTitle = screen.getByTestId("pageTitle"); const expectedTitle = "My Web Page"; expect(actualTitle).toBe(expectedTitle); });
test("Validate title", () => { render(<App />); const actualTitle = screen.getByTestId("pageTitle"); const expectedTitle = "My Web Page"; expect(actualTitle).toBe(expectedTitle); });
function("Validate title", () => { render(<App />); const actualTitle = screen.getByTestId("pageTitle"); const expectedTitle = "My Web Page"; expect(actualTitle).toBe(expectedTitle); });
What is this code in JavaScript:
/Make Your Reservation/
?RegExp object literal
A string literal
An array literal
How many major elements are outlined by the WCAG (Web Content Accessibility Guidelines) for designing accessible websites?
three
six
four
five
True or False: You can use arrow functions to update the state of a component.
True
False
Only in some cases.
Only in certain types of state.