Share state with ease.
License: MIT License
我对这个 rfcs 的理解好像和你的实现不同
在你的实现,每次 Context.Provider
render
时,都会给 Context
新的 write
函数,如果多 Provider
怎么办?如果 write
修改所有的 Provider
的 value
就失去了 Provider
分形的意义,如果只修改最后一个被 render
的 Provider
明显不符合开发者的预期。
react useContext
在 Context.Provider
未给出的时候,会回到 initialValue。我理解,Context.write 可以修改这个 value,但是在这个库,并不能。
我的一部分实现:https://codesandbox.io/s/reactcontextio-example-9361p
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.