react-context-connector:React HOC对新的Context API保持使用像React-Redux connect HOC一样简单

时间:2021-05-02 10:40:35
【文件属性】:
文件名称:react-context-connector:React HOC对新的Context API保持使用像React-Redux connect HOC一样简单
文件大小:60KB
文件格式:ZIP
更新时间:2021-05-02 10:40:35
JavaScript React上下文连接器 React HOC对新的Context API保持使用像React-Redux connect HOC一样简单。 用法 connectContext(ContextProvider,mapContextToProps) 生成一个HOC来包装带有props中的上下文值的组件。 参数 ContextProvider : Object ,具有Consumer属性的对象,例如Context对象或Custom Provider mapContextToProps : function ,一种从Context.Consumer接收上下文并返回一个对象的功能,该对象将用作包装组件的道具。 返回: Component ,一个HOC,它将上下文状态传递给子组件的props。 例子 创建您的上下文提供程序 const CounterContext = React . crea
【文件预览】:
react-context-connector-master
----yarn.lock(194KB)
----src()
--------__tests__()
--------index.js(1KB)
----.babelrc(149B)
----.npmignore(77B)
----.travis.yml(114B)
----example()
--------src()
----README.md(2KB)
----dist()
--------index.js(2KB)
----.gitignore(58B)
----package.json(1KB)

网友评论