Fill the blank to display a property keywords:
keywords
class Search extends React.Component { constructor() { super(); this.state = { keywords: "JavaScript" }; } render() { return ( <p>{.keywords}</p> ); } } ReactDOM.render(<Search/>, document.body);
No tests found
The component's state:
contains data props that were defined by the caller of this component
contains data specific to this component that may change over time
provide a way to access DOM nodes or React elements created in the render method
let you group a list of children without adding extra nodes to the DOM
Is it possible to split JSX over multiple lines in React?
const element = <h1>Hello, Kate Simson !</h1>; ReactDOM.render(element, document.getElementById('root'));
yes
no
JSX doesn't allow to use self-closing tags. True or false?
<UserProfile />
true
false
What shows in console when a user clicks the button?
class MyButton extends React.Component { state = { x: 1, y: 2 }; render() { return ( <button onClick={this.handleClick}>click me</button> ); } handleClick = () => { this.setState({ x: 10, y: 20 }, () => { console.log(this.state); }); } } ReactDOM.render(<MyButton/>, document.getElementById("root"));
{x: 1, y: 2}
{x: 10, y: 20}
nothing
throw an error
Which of the following examples are the proper ways to update the local state in the class component in React?
state
this.setState("keywords", value)
this.setState({keywords: value})
this.setState(["keywords", value])
this.setState((state) => ({keywords: value}))
Which method should be used to initialize local state when you use createReactClass function?
createReactClass
initState
getInitialState
setInitialState
bootState
In React local state can be used by:
function component
class component
both class and function component
Which method is used to update state in React?
updateState
setState
refreshState
setState() is:
setState()
always synchronous
always asynchronous
sometimes synchronous
sometimes asynchronous
«1234»