Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我开始使用google-map-react并发现这一行:
const AnyReactComponent = ({ text }) => <div>{text}</div>
它有什么作用?
这是一个无状态的函数组件(即函数是一个render函数,props作为参数)。功能可以这样重写:
render
props
class AnyReactComponent extends React.Component { render() { const { text } = this.props; return <div>{text}</div>; } }