question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add class to the extra div generated by withAuthenticator HOC

See original GitHub issue

When wrapping withAuthenticator around a component, if the user is signed in, an extra div is created:

if (signedIn) {
    return (
        <div>
            {
                includeGreetings?
                <Greetings
                    authState={authState}
                    authData={authData}
                    onStateChange={this.handleAuthStateChange}
                  />
                  : null
                }
                <Comp
                    {...this.props}
                    authState={authState}
                    authData={authData}
                    onStateChange={this.handleAuthStateChange}
                 />
        </div>
    )
}

There needs to be a way to either add properties to that div or to remove it.

Straight forward way would be to add another argument to the withAuthenticator function.

Workaround at this point is to simply use the Authenticator component directly.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Amiram1commented, Jan 3, 2019

@jordanranz, yeah, fragment is preferable.

0reactions
github-actions[bot]commented, Jun 13, 2021

This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authenticator - React Native - AWS Amplify Docs
Using withAuthenticator HOC. For React Native, the simplest way to add authentication flows into your app is to use the withAuthenticator Higher Order ......
Read more >
Add a class to the HTML <body> tag with React?
TL;DR use document.body.classList.add and document.body.classList.remove. I would have two functions that toggle a piece of state to ...
Read more >
Amplify UI's new Authenticator component makes it easy to ...
Amplify UI's new Authenticator component makes it easy to add customizable login pages to your React, Angular, or Vue app.
Read more >
Higher-Order Components In React - Smashing Magazine
A HOC is an advanced technique for reusing logic in React components. It is a pattern created out of React's compositional nature.
Read more >
Add a class to the newly created div using JavaScript - YouTube
Working Demo:http://codifyacademy.com/youtube/wk09/video-04Download the source code ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found