the-road-to-react-with-firebase / react-firebase-authentication

🔥 Boilerplate Project for Authentication with Firebase in React.
https://www.robinwieruch.de
1.02k stars 298 forks source link

Using a class rather than an inline function for the component property in Route #8

Closed tezzutezzu closed 5 years ago

tezzutezzu commented 6 years ago

Hi @rwieruch and thanks for your hard work on this.

In your example, shouldn't the Route components' value be a class rather than an inline function?

According to react-router docs, in that way a new component is created every time rather than being updated.

Here's a proposed change:

<Route exact path={routes.LANDING} component={LandingPage} />

<Route exact path={routes.SIGN_UP} component={SignUpPage} />

<Route exact path={routes.SIGN_IN} component={SignInPage} />

<Route exact path={routes.PASSWORD_FORGET} component={PasswordForgetPage} />

<Route exact path={routes.HOME} component={HomePage} />

<Route exact path={routes.ACCOUNT} component={AccountPage} />
rwieruch commented 5 years ago

Good point. Do you have the time to fix it first over here: https://github.com/rwieruch/the-road-to-react-with-firebase in a PR? Afterward, all applications built in the tutorial should be adjusted as well (which I can do):

rwieruch commented 5 years ago

Fixed in tutorial, will fix later in applications.