How do I update a component periodically?

Set a timer to periodically change the state or props of the component

Write an example of what is JSX’s inline conditional rendering

import React from 'react'; function App() { return <Toolbar falg={false} />; } class Toolbar extends React.Component { constructor(props) { super(props); this.el = document.createElement('div'); } render() { return <div>{this.props.falg ? }</div>; } } export default App;Copy the code

How do YOU pass parameters to events in React?

The event is the last parameter of the function argument

import React from 'react'; function App() { return <Toolbar falg={false} />; } class Toolbar extends React.Component { constructor(props) { super(props); This. state = {name: 'initial state value'}; } handleEvent(name, e) { console.log(e); this.setState({ name: name + '1' }); } render() { return ( <input onClick={this.handleEvent.bind(this, this.state.name)} value={this.state.name} ></input> );  } } export default App;Copy the code

How are React events different from normal HTML events

  • React uses upper case onclick for normal events
  • React events are called in double quotes. React events are called in {}
  • The React event function cannot use return false to prevent the default behavior. PreventDefault must be used to prevent the default behavior
</input> React: <input onclick = {this.hangdlechange}></input>Copy the code

Which feature of React do you like best (just name one)?

Virtual DOM, JSX syntax preparation