-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate react-blockstack package #4
Comments
I have merge the PR, but now I am stuck with the question how to add radiks. See njordhov/react-blockstack#3 |
Radiks should be initialized when the user has been authenticated, right? You can initialize Radiks when useEffect(() => {
if (userData) {
/* Initialize Radiks here */
setSignIn({ checking: false, user: userData, isSignedIn: true });
} else {
setSignIn(NotSignedIn);
}
}, [userData]); You can alternatively create a separate watch/effect for Radiks initialization like the one above. |
@njordhov I have added radiks, it looks like it works. Do you have any ideas how to use react-blockstack in Nav.js? |
I take you'd like to avoid passing the UserStateContext from Nav.js. Here are some suggestions. A) As Nav is a react class component, useBlockstack() can't be called from the render function. You may rewrite it to be a function component. Alternatively, factor out the relevant parts from render into function components, specifically those conditioned on B) Note that userData from useBlockstack only is truthy when authenticated, so you can use that to test for isSignedIn. As userData is available in App-Container where the Nav component is used, consider adding an |
I am very excited about your gitix project. It's one of the most promising Blockstack projects by far.
I hope you're open to pull requests? I've submitted PR #3, which takes a first stab at integrating the react-blockstack package, providing react hooks for the Blockstack SDK.
The text was updated successfully, but these errors were encountered: