feat: implement React Hooks library for Live Context State Management (#37)#58
Open
annukumar123 wants to merge 2 commits into
Open
feat: implement React Hooks library for Live Context State Management (#37)#58annukumar123 wants to merge 2 commits into
annukumar123 wants to merge 2 commits into
Conversation
keepsloading
requested changes
Jul 8, 2026
keepsloading
left a comment
Member
There was a problem hiding this comment.
@annukumar123 Thanks for working on this! I've reviewed the PR and have a few requests for changes:
ReactInstancecheck useswindow.React, which can throw a ReferenceError in non-browser environments ifwindowis completely undefined. You should checktypeof window !== "undefined"which you did, but then it's safer to useglobalThis.React.- The
MemactProviderimplementation dynamically tries to create a Context on every render:R.createElement(R.createContext(null).Provider, ...).createContextshould be called OUTSIDE of the component rendering cycle. If it's called inside, it creates a new context instance on every render, and consumers will never re-render when the value changes, or they won't be able to match the context instance. You should export a stable context instance. - In
useContextClaim,contextClientis currently being extracted astypeof options.client === "object" ? options.client : null. This defeats the purpose of theMemactProvider! The hook should useReact.useContextwith the stable context instance created outside the component to get the client provided byMemactProvider.
Please address these architectural issues with the React bindings and push the changes. Thank you!
Author
|
@keepsloading |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔎 Overview
This PR introduces an agnostic React Hooks state library mapping to issue #37, exposing clean context abstractions for application components subscribing to live streaming token updates.
🛠️ Changes Implemented
src/react.mjsexporting a functionalMemactProviderelement and customuseContextClaim()live state observer hooks.src/index.mjs.test/react.test.mjsrunning completely clean with 0 external dependencies.Fixes #37