Linkedin offers an online quiz to test React.js skills. I collected questions from this test.
1) When do you use useLayoutEffect?
( ) to change the layout of the screen
( ) when you need the browser to paint before the effect runs
(*) to complete the update
( ) to optimize for all devices
2) How do you fix the syntax error that results from running the code?
const person = (firstName, lastName) =>
{
first: firstName,
last: lastName
}
console.log(person("Jill", "Wilson"));
( ) Add a return statement before the first curly brace
(*) Wrap the object in parentheses
( ) Call the function from another file
( ) Replace the object with an array
3) What is the children prop?
( ) a property that lets you pass data to child elements
(*) a property that lets you pass components as data to other components
( ) a property that lets you set an array as a property
( ) a property that adds child components to state
4) What is [e.target.id] called in the following code snippet?
handleChange(e) {
this.setState({[e.target.id]: e.target.value})
}
( ) a set value
(*) a computed property name
( ) a dynamic key
( ) a JSX code string
5) What is the name of the tool used to take JSX and turn it into createElement calls?
( ) JSX Editor
( ) Browser Buddy
(*) Babel
( ) ReactDOM
6) Why is it a good idea to pass a function to setStateinstead of an object?
( ) It makes sure that the object is not mutated
( ) It is more functional than an object
(*) setState is asynchronous and might result in out of sync values.
( ) It automatically updates a component
7) When using webpack, why would you need to use a loader?
( ) to put together physical file folders
( ) to load external data
( ) to load the website into everyone's phone
(*) to process files
8) Which of these terms commonly describes React applications?
( ) closed
( ) integrated
(*) declarative
( ) imperative
9) All React components must act like ____ with respect to their props.
(*) pure functions
( ) higher-order functions
( ) recursive functions
( ) monads
10) What do you call the message wrapped in curly braces below?
const message = "Hi there";
const element = <p>{message}</p>
(*) a JSX wrapper
( ) a JS function
( ) a JS expression
( ) a JS element
11) What can you use to handle code-splitting?
( ) React.split
( ) React.fallback
( ) React.memo
(*) React.lazy
12) Which of these Hooks could be used to update a documents title?
( ) useEffect(function() {title = name + ' ' + lastname;})
( ) useEffect(() => {title = name + ' ' + lastname;})
(*) useEffect(function updateTitle() {document.title = name + ' ' + lastname;})
( ) useEffect(function updateTitle() {name + ' ' + lastname;})
13) Which attribute do you use to replace innerHTML in the browser DOM?
(*) dangerouslySetInnerHTML
( ) strangeHTML
( ) weirdSetInnerHTML
( ) injectHTML
14) What property do you need to add to the Susense component in order to display a spinner or loading state?
function MyComponent() {
return (
<Suspense>
<div><Message/></div>
</Suspense>
);
}
( ) spinner
(?) fallback
( ) loading
( ) lazy
15) React components are composed to create a user interface. How are components composed?
( ) with webpack
( ) with code splitting
(*) by nesting components
( ) by putting them in the same file
Comments
Post a Comment