Giter Site home page Giter Site logo

ravindumadu / deploy-react-web-application-on-netlify Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 7 KB

This guide will help you deploy your React web application on Netlify and fix any navigation errors using a <code>netlify.toml</code> file.

License: MIT License

deployment deployment-services hosting netlify netlify-deployment react-deployment web-deployment web-hosting netlify-deploy-error react-deploy-netlify

deploy-react-web-application-on-netlify's Introduction

Deploy React Web Application on Netlify

Introduction

This guide will help you deploy your React web application on Netlify and fix any navigation errors using a netlify.toml file.

Steps to Deploy

1. Create a React Application

npx create-react-app my-app

Navigate into your project directory:

cd my-app

2. Initialize a Git Repository

git init
git add .
git commit -m "Initial commit"

3. Push to GitHub

Create a repository on GitHub and push your project:

git remote add origin https://github.com/your-username/your-repo-name.git
git branch -M main
git push -u origin main

4. Deploy on Netlify

Login to Netlify and create a new site from Git:

  • Choose your GitHub repository
  • Set the build command to npm run build
  • Set the publish directory to build

5. Fix Navigation Errors

To fix navigation errors (e.g., 404 errors on page refresh), create a netlify.toml file in the root of your project with the following content:

[build]
  command = "npm run build"
  publish = "build"

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

6. Commit and Push the netlify.toml File

git add netlify.toml
git commit -m "Add netlify.toml to fix navigation errors"
git push

7. Redeploy the Site

Go to your Netlify dashboard and trigger a redeploy of your site to apply the changes.

Conclusion

By following these steps, you should have your React web application deployed on Netlify without navigation errors. The netlify.toml file ensures that all navigation requests are correctly redirected to your index.html file.

deploy-react-web-application-on-netlify's People

Contributors

ravindumadu avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.