Code Monkey home page Code Monkey logo

web-reactrouterii-guided-project's Introduction

How to Run this App

  • Clone repository.
  • Run npm install or yarn install.
  • Run npm run dev or yarn run dev.
  • Run npm test or yarn test.
  • Serve index.html using live-server or similar.

Requirements

We need node & npm, as well as packages live-server and eslint installed globally. VSCode's eslint extension is recommended. Command line commands are run inside the project folder. This guide uses npm but should work the same using yarn.

Objectives

  • Dive deeper into React Router.
  • Learn about the render prop for inlining functions inside Route.
  • Learn about the children prop for inlining functions inside Route.
  • Passing "normal" props along to the component rendered by Route.
  • Passing history, match and location props to the component rendered by Route.
  • Creating sub-routes using match.path.
  • Learn about history.push().
  • Learn about history.replace().
  • Creating Navlinks using match.url.
  • Learn about the NavLink component.
  • Style Links and Navlinks using styled-components.
  • Learn about Switch component.
  • Learn about Redirect component.
  • Learn about withRouter HOC.

Exercises

  • How to pass player into components.
  • How to have something render always but still get history, location and match.
  • Have a children component render to the screen whether there is match or not.
  • Have tic tac toe randomly redirect to Home.
  • Have blackjack check for 'authed' in local storage and send you to Home if there isn't one.
  • Style a Navlink using styled-components.
  • Use withRouter to give a component knowledge of history, match and location.
  • Create dynamic subroutes to blackjack and have the links disappear when user clicks link to sub route.

web-reactrouterii-guided-project's People

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.