GithubHelp home page GithubHelp logo

johnkirtley / react-router-basic-nav Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bloominstituteoftechnology/react-router-basic-nav

0.0 1.0 0.0 580 KB

HTML 47.32% CSS 4.79% JavaScript 47.89%

react-router-basic-nav's Introduction

React Router Basic Nav

Topics:

  • Single Page Applications
  • React Router V4 (react-router-dom)
  • Routing, declarative component based routing
  • Path and Component

Project Description

  • A starter pack project for all things React Router. Learn to set up a basic routing system within an application. Use this application to help guide your learning over the next couple of days.
  • Note that this project has already been boilerplated for you. There is no need to run any installation steps beyond yarn install.

Initialize Project

  • cd into the repository and run yarn install
  • run yarn start

Steps for implementing React Router

  • You'll notice we've already installed react-router-dom for you.
  • import your BrowserRouter as Router inside your index.js file.
  • Wrap your <App /> component that you're passing to ReactDOM.render() with your new Router component.
  • open up your chrome REACT DEV TOOLS and notice your app is now all wrapped in BrowserRouter

Steps for "Declaring" your routes

  • Inside of your App.js file import { Route } from 'react-router-dom';
  • This is where we're going to declare and specify our router.
  • Create 3 <Route /> setting their path prop equal to /, /about, /contact with their respective components.
  • Be sure to include the exact prop on the root component for / to make sure that it's rendering the exact component and not all the other components.

Steps for setting up your Navigation

  • Inside of Navigation.js import { Link } from 'react-router-dom'.
  • Declare the to as the href on <Link> and specify the correct routes for your app to navigate towards.
  • Head over to your app and start navigating. You should be able to see your URLS changing their paths as you go. Each path should display the proper component.

Resources

react-router-basic-nav's People

Contributors

ryan-hamblin avatar cmgorton avatar jasonsbarr avatar rodrigograca31 avatar johnkirtley avatar justsml avatar ladrillo avatar

Watchers

James Cloos 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.