'Custom domain name for github pages only works for homepage, all other 404

I just linked a custom domain I got from google domains to a github pages react app. Currentely, when I go to the custom domain, the homepage of the website works fine, however, when I click on any links, firstly, the react-router doesn't change pages. And Secondly, when I reload the page, it still just loads the homepage and returns a 404 error.

Here is the repository with all the code: https://github.com/Been-H/ridge-road-journal-website

And on google domains, I have these as my type A records:

185.199.108.153 185.199.109.153 185.199.110.153 185.199.111.153

And this as my CNAME I have host name www and the data is my github (been-h.github.io

Does anyone know why only the homepage is working and nothing else? Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source