Skip to content
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

add basic example to show connected address #721

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

technophile-04
Copy link
Collaborator

Description

Context: If you directly use useAccount / any other hooks on home you get the below error from Next which is not at all helpful and hard to debug

Not so helpful error:

Screenshot 2024-02-14 at 12 55 00 PM

The solution to this is adding "use client" at the beginning of the file (this might be not all obvious for beginners)

This PR adds a default example of showing the connected address (this way we have "use client" at the top of file already and might save some users from pitfalls)

Please feel free to suggest any other place where we could add currently added it below SE-2 text :

Demo Video
Screen.Recording.2024-02-14.at.12.50.37.PM.mov

Copy link
Collaborator

@Pabl0cks Pabl0cks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition! I personally suffered from that kind of not so helpful error, and I think it can save time to beginners, and prevent some ragequit.

Another place where could be added is below the Tinker/Explore boxes.

Something like this

image

Copy link
Collaborator

@rin-st rin-st left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@damianmarti
Copy link
Collaborator

@technophile-04 I have code in se-2 projects that uses useAccount without adding "use client" and useAccount is working fine. What I'm missing?

@carletex
Copy link
Member

@technophile-04 I have code in se-2 projects that uses useAccount without adding "use client" and useAccount is working fine. What I'm missing?

@damianmarti This only happens after migrating to the Next App Router (we did it a couple of weeks ago in #535)

@rin-st
Copy link
Collaborator

rin-st commented Feb 15, 2024

@technophile-04 I have code in se-2 projects that uses useAccount without adding "use client" and useAccount is working fine. What I'm missing?

Or you have 'use client' in parent components/page

@technophile-04
Copy link
Collaborator Author

Tysm all merging it 🙌

@technophile-04 technophile-04 merged commit 7c34f62 into main Feb 15, 2024
1 check passed
@technophile-04 technophile-04 deleted the connectedAddress-example-homepage branch February 15, 2024 18:24
kmjones1979 added a commit that referenced this pull request Feb 15, 2024
* Add Optimism Sepolia config (#711)

* Use arbitrumSepolia instead of Goerli (#716)

* up rainbowkit version to 1.3.5 (#719)

* removing lock file

* use next-themes to handle theme and update usehooks-ts (#707)

* Feat: Better complex struct inputs (#702)

* improve debug struct UI (#726)

* add basic example to show connected address (#721)

---------

Co-authored-by: winnsterx <46658657+winnsterx@users.noreply.github.com>
Co-authored-by: Shiv Bhonde | shivbhonde.eth <shivbhonde04@gmail.com>
Co-authored-by: Carlos Sánchez <oceanrdn@gmail.com>
@technophile-04 technophile-04 mentioned this pull request Feb 26, 2024
@github-actions github-actions bot mentioned this pull request Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants