npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-tsvite-cli

v1.0.10

Published

react+ts+vite的脚手架

Downloads

23

Readme

React-TsVite-Cli

In order to unify project development, self organized scaffolding of projects based on React, Redux and React Router Dom

technology stack

1、React+Hooks
2、Ts+Scss
3、react-router-dom@6
4、Redux、react-redux
5、axios

Using

1、npm install -g react-tsvite-cli
2、react-tsvite-cli create your-projectname
3、cd ./your-projectname
4、npm run dev

Redux

  1. A corresponding Redux status management tree will be created by default for the page opened by the tab of each browser; (Therefore, the data of the status management tree of each tab is not synchronized.)
  2. The main function of Redux is to handle the state management of SAP single page type. For SSR pages with high complexity, they need to be used in combination with storage.
  3. Redux should not store sensitive data, which is easy to obtain.
  4. In combination with the use of React, Redux needs to add a react redux plug-in.
  5. To implement asynchronous actions, Redux needs to add: act trunk

React-router

  1. The overall route adopts[“ react-router-dom@6 "] Plug ins can be used as BrowserRouter, HashRouter, and HistoryRouter; Commonly used: BrowserRouter
  2. The overall management of routes is placed in the/src/routes folder
  3. For router jump management, you must add path="*" as the management of 404 pages.
  4. In the version of react router v6, the encapsulated hooks writing method is added. Therefore, this architecture mainly adopts the React Hooks writing method.
  5. Commonly used hooks need to be memorized and understood: useHref, useNavigate, useParams, etc.
  6. UseHref: returns a link relative to the current route
  7. UseInRouterContext: returns a boolean value of whether the current component is in the react router. It is very useful for third-party extensions that want to know whether the current component uses the react router
  8. UseLocation returns a current routing object
  9. UseNavigate returns a NavigateFunction, which can be used for programmatic navigation, equivalent to a Navigate component
  10. UseNavigationType returns the NavigationType, which can be used to determine how to get to the [POP "," PUSH "," Replace "] of the page
  11. UseOutletContext: then you can receive the data passed from the parent route
  12. UseParams: used to obtain the params of the current route
  13. UseResolvedPath: used to resolve the given path. You can pass in a relative url and an absolute url and return an object
  14. useRoutes: Pass in an array of routes and return the corresponding components to be displayed. It is somewhat similar to the configuration of routes in vue. You can configure routes in other folders
  15. The hooks of useLinkClickHandler return a click event handler, which can be used to create a custom jump link. After clicking, you can jump to the target link. You can pass a to (target link) and an options
  16. UseSearchParams: returns a data, the first is searchParams, the second is setSearchParams, which is used to update searchParams,