Search code examples
reactjsgithubbuildgithub-pagesnetlify

Why is my React App Rendering Blank but Black?


React App Rendering Blank but Black on Netlify

I’m sorry to say, that I the dredded Netlify blank screen. So I apologize for adding to the tons of blank screen questions.

I am new to Netlify and I switched from GitHub because of the routing issues. I spent a lot of time trying to figure out routing for my React app to no avail. After the switch to Netlify I worked through a lot of things and ended up getting rid of the white blank screen that I initially had. Now after some reworking, it's rendering black. I’m not entirely sure, but that makes me feel like I’m on the right track, because my React app is mostly black. I’m thinking it could be an html issue, but it is running completely fine locally.

https://github.com/ToniTepes/tonitepes.github.io
https://peaceful-caramel-4fb6dc.netlify.app/

Also, could you let me know if my routing is correct for Netlify?

No Error. Building correctly

Sorry I can't post images I guess...

I appreciate any help and sorry for the redundant post.


Solution

  • Create a netlify.toml file inside your root folder paste this code:

    Update from Netlify's answers:

    [build]
      command = "npm run build"
      publish = "build/"
    
    [[redirects]]
    from = '/*'
    to = '/index.html'
    status = 200
    

    Then git push to your repo.

    That's the piece of code that always works for me, if you have any issue just tell me below or read the thorough examples at Netlify docs for more info.


    As a side-note make sure to include your .env inside .gitignore.