Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 3 years ago

Fireabase, ReactJS, SASS, Google Sign-in

firebase, sass/scss, react
Jonel Hatwell•585
@hatwell-jonel
A solution to the Todo app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hello,

This is my first time using firebase to my project, because of that I struggled to write clean code. and some problem that I encountered that is difficult for me to fixed. like in this application when you already logged and refresh the page there a error page that I don't know how to fixed.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Sean Red•635
    @seanred360
    Posted about 3 years ago

    I would also use a different design for your page routing. You should have a login page and a homepage only. You need to make a "protected route". Basically when the user tries to go to the homepage, the router checks if they are logged in, if not it will not allow them to go to the homepage. Instead it will redirect them to the login page every time they try to go to the homepage. You can see this behavior in my project here. https://www.frontendmentor.io/solutions/full-stack-mern-react-firebase-rest-api-mongodb-L08z7tmdo

    This design structure also allows you to forbid a user from viewing an account page that they do not own or an edit page for a comment they do not own.

    edit: I see you do have a protected route, I would make the hompage the default "/" and login page as "/login"

    You should change your routes to something like this:

    <Routes> <Route exact path="/" element={ <Protected> <HomePageNameHere /> </Protected> } /> <Route path="/signup" element={<Signup />} /> </Routes>

    and change Protected.jsx to

    const Protected = ({ children }) => { const { user } = useAuth(); if (!user) { return <Navigate to="/signup" />; }

    return children; };

    Marked as helpful
  • Sean Red•635
    @seanred360
    Posted about 3 years ago

    When you refresh the page, your app looks for a HTML file named account. There is no such file do you are getting a 404 error. You need to tell firebase to redirect the user to the homepage when they navigate to /account instead of trying to get a page that does not exist. Your firebase.json should look like this.

    { "hosting": { "public": "build", "ignore": ["firebase.json", "/.*", "/node_modules/"], "rewrites": [ { "source": "", "destination": "/index.html" } ] } }

    Marked as helpful
  • Sean Red•635
    @seanred360
    Posted about 3 years ago

    I tried to download and run your code, but you have dependency errors in your package.json. The version of React you have does not work with react-beautiful-dnd. It looks to me like you ran a forced update with NPM which is not a good idea. I am not sure how you got this to deploy with this problem as the react build script cannot run like this.

    Marked as helpful

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub