I started work with google-map-react and found this line:
const AnyReactComponent = ({ text }) => <div>{text}</div>
What does it do?
I started work with google-map-react and found this line:
const AnyReactComponent = ({ text }) => <div>{text}</div>
What does it do?
This is a stateless functional component (that is, the function is a render
function, taking props
as argument). The functionality could be rewritten like this:
class AnyReactComponent extends React.Component {
render() {
const { text } = this.props;
return <div>{text}</div>;
}
}