Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

hosting spa on github pages

### Notes on client-side routing:
### GitHub Pages doesn’t support routers that use the HTML5 `pushState` history API under the hood 
### (for example, React Router using `browserHistory`). 
### This is because when there is a fresh page load for a url like `http://user.github.io/todomvc/todos/42`, 
### where `/todos/42` is a frontend route, 
### the GitHub Pages server returns 404 because it knows nothing of `/todos/42`. 
### If you want to add a router to a project hosted on GitHub Pages, 
### here are a couple of solutions:* 
### You could switch from using HTML5 history API to routing with hashes. 
### If you use React Router, you can switch to `hashHistory` for this effect, 
### but the URL will be longer and more verbose 
### (for example, `http://user.github.io/todomvc/#/todos/42?_k=yknaj`). 
### [Read more](https://reacttraining.com/react-router/web/api/Router) about different history implementations in React Router.* 
### Alternatively, you can use a trick to teach GitHub Pages to handle 404 by redirecting 
### to your `index.html` page with a special redirect parameter. 
### You would need to add a `404.html` file with the redirection code to the `build` folder before deploying 
### your project, and you’ll need to add code handling the redirect parameter to `index.html`. 
### You can find a detailed explanation of this technique [in this guide](https://github.com/rafrex/spa-github-pages).

### Check the article for more info
### extra note from me: If you still can't get anything to render except the homepage even after giving the "exact" param
### then try moving your homepage router to the end of the switch tag
### that way it'll be checked at the very last for matching the url
Comment

PREVIOUS NEXT
Code Example
Shell :: remote: Please see https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations/ for more information. 
Shell :: shell combine gzipped files 
Shell :: vscode disable powershell integrated console 
Shell :: git push rejected 
Shell :: django load data 
Shell :: conda install pdf2image 
Shell :: vscode display all extensions 
Shell :: alpine sudo 
Shell :: Clear heroku redis cache 
Shell :: rdp linux ubuntu 
Shell :: kubectl switch namespace command 
Shell :: ssh copy from remote to local 
Shell :: remove remote git 
Shell :: how to assign an ad group to a folder mac os terminal 
Shell :: remove symfony ubuntu 
Shell :: docker run image command 
Shell :: bash return every nth line 
Shell :: how to max cpu usage in linux 
Shell :: cmd taskkill 
Shell :: docker delete network 
Shell :: Expose local postgres database over https 
Shell :: linux change hostname 
Shell :: check internet speed on mac terminal 
Shell :: pm2 typescript 
Shell :: Unable to create directory wp-content/uploads/. Is its parent directory writable by the server? 
Shell :: sqlmap get injection 
Shell :: install supervisor ubuntu 20.04 
Shell :: git force rebase abort 
Shell :: see changes to be pushed git 
Shell :: jest 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =