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

Functions are not valid as a React child #41

Open
Ajwah opened this issue Nov 15, 2020 · 0 comments
Open

Functions are not valid as a React child #41

Ajwah opened this issue Nov 15, 2020 · 0 comments

Comments

@Ajwah
Copy link

Ajwah commented Nov 15, 2020

Once I implemented the chapter: Email Verification I get the warning:

Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.

Screen Shot 2020-11-15 at 9 18 42 AM

This warning is generated for the following router components:

<Route exact path={ROUTES.HOME} component={HomePage} />
<Route exact path={ROUTES.ACCOUNT} component={AccountPage} />
<Route exact path={ROUTES.ADMIN} component={AdminPage} />

Their common denominator is that they all compose over the HOC: withEmailVerification. When I comment out:

then the warning disappears.

I tried googling for answers and found this: https://stackoverflow.com/a/48458532/4400976 but I do not see how our HOC is being misused as a regular component as the answer is alluding to. It is the exact same pattern we are using for withAuthorization and withAuthentication; e.g. a declaration of HOC that embeds the argument Component by means of a closure and that we use for our compositions accordingly. But the warning would not come about then.

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

No branches or pull requests

1 participant