[react] childContextTypes是什么?它有什么用?
生活随笔
收集整理的這篇文章主要介紹了
[react] childContextTypes是什么?它有什么用?
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
[react] childContextTypes是什么?它有什么用?
childContextTypes用來定義context數據類型,該api從16.3開始已被廢棄
使用方式
class MessageList extends React.Component {getChildContext() {return {color: "purple"};}render() {return <div>MessageList</div>;} }MessageList.childContextTypes = {color: PropTypes.string };?個人簡介
我是歌謠,歡迎和大家一起交流前后端知識。放棄很容易,
但堅持一定很酷。歡迎大家一起討論
主目錄
與歌謠一起通關前端面試題
總結
以上是生活随笔為你收集整理的[react] childContextTypes是什么?它有什么用?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html5游戏怎么做apk,如何把h5a
- 下一篇: React开发(246):react项目