Future prospects
The implementation of React Tracked depends on two internal libraries:
proxy-compare
(https://github.com/dai-shi/proxy-compare)use-context-selector
(https://github.com/dai-shi/use-context-selector)
As we learned in the Using React Tracked with useState and useReducer section and the Using React Tracked with React Redux section, there are two ways to use React Tracked. The first way is via React Context with createContainer
and the second is via React Redux with createTrackedSelector
. The base function is createTrackedSelector
, which is implemented with the proxy-compare
library. The createContainer
function is a higher abstraction, which is implemented with createTrackedSelector
and the use-context-selector
library.
In terms of the use of Context in React Tracked, the use-context-selector
library is important. What is the role of use-context-selector
? It provides a useContextSelector
hook. As we learned in the Understanding Context section in...