context
跨级通信
childContextType :老的, React17废弃
createContext :React16之后
import React from 'react'
import PropTypes from 'prop-types'
const {Provider, Consumer} = React.createContext("default")
class Parent extends React.Component {
state = {
childContext:"123",
newContext:"4567"
}
render() {
return (
<React.Fragment>
)
}
}