React is the implementation method for passing the class name to the child component through the parent component.
React tutorial
React is a JAVASCRIPT library used to build user interfaces.
React is mainly used to build the UI. Many people think that React is the V (View) in MVC ).
React originated from Facebook's internal project, which was used to build Instagram websites and was open-source in May 2013.
React has high performance and the code logic is very simple. More and more people are paying attention to and using it.
React features
1. Declarative design-React uses the declarative paradigm to easily describe applications.
2. Efficient-React simulates DOM to minimize interaction with DOM.
3. Flexibility-React can work well with known libraries or frameworks.
4. JSX-JSX is an extension of JavaScript syntax. JSX is not necessarily used for React development, but we recommend that you use it.
5. component-build components through React to make code more reusable and be well applied to the development of large projects.
6. One-way response data streams-React implements one-way response data streams, thus reducing repeated code, which is why it is simpler than traditional data binding.
1. Method for passing the class name to the child component through the parent component (19th rows)
2. Apply some class names (22nd rows) with different status values)
import React from 'react'import './style.css'class PageTitle extends React.Component { constructor(props, context) { super(props, context); this.state = { timeType:0 } } handleClick(timeType){ this.setState({ timeType:timeType }); this.props.handle(timeType+1); } render() { const {title,dataList} = this.props; return (
Summary
The above is the implementation method of the React that passes the class name to the child component through the parent component. I hope it will be helpful to you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!