Giter VIP home page Giter VIP logo

react-router-tag's Introduction

React-Router source code marking

React-Router v6 已经舍弃 history 包, 而是自己实现了一个 packages/router/history.ts

基本原理

对 window.history 进行封装, 并注册 popstate 事件,每次点击 Link 组件都会执行 pushState,但这仅仅只是修改了 url,并不会更新组件。所以就需要在路由的根组件(BrowserRouter)注册一个更新函数。以后每次点击 Link 之后都要执行 pushState 和更新函数。更新函数只是更新路由组件,但怎么匹配到指定的路由组件呢?在 Routers 中会有一个对比函数,使 url 和 路由组件保持一致。

popstate 事件: 前进、后退、a 标签、代码里执行 history.back() 、history.forward()、history.go()

标签

安装插件后即可在左侧待办事项看到众多 TAG

https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree

image

react-router-tag's People

Contributors

mjackson avatar ryanflorence avatar taion avatar timdorr avatar chaance avatar brophdawg11 avatar knowbody avatar gaearon avatar pshrmn avatar remix-cla-bot[bot] avatar mcansh avatar remix-run-bot avatar agundermann avatar github-actions[bot] avatar tylermcginnis avatar coryhouse avatar avanderhoorn avatar nhunzaker avatar jimniels avatar stringepsilon avatar schniz avatar jacob-ebey avatar tgallacher avatar daphnisli avatar bradwestfall avatar brigand avatar tyankatsu0105 avatar sophiebits avatar michaeldeboey avatar dancannon 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.