Git Product home page Git Product logo

vps-react-query's Introduction

vite-plugin-ssr with Tanstack react query

This is a demo of how to use vite-plugin-ssr with react-query.

This is a very simple example just to show the integration between the two libraries.

How to use

Install dependencies

I used pnpm to install the dependencies, but you can use npm or yarn as well.

pnpm install

or

yarn install

or

npm install

Run dev server

Use the "dev" script from package.json, be sure to have the 3000 port available.

Build

Use the "build" script from package.json, the build will be in the "dist" folder. By default this example is using prerendering, you can change this in the "vite.config.js" file.

Run

Use the "server:prod" to run the server in production mode. or use the "prod" script to build and run the server.

How it works

The main idea is to use the "react-query" library to prefetch the data on the server side and then hydrate the client with the same data.

On the client we can reuse the same data to avoid fetching it again and then we are free to use the library to mutate or refetch the data as we want.

Features

  • React Query
  • Prerendering by default (can be disabled in vite.config.js)
  • Server Side Rendering is possible as well
  • TypeScript
  • Client routing provided by vite-plugin-ssr
  • Client refetching example with react-query

Contributing

Pull requests and issues are welcome ๐Ÿ˜Š!

vps-react-query's People

Contributors

renovate[bot] avatar yannbirba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

radandevist

vps-react-query's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • fix(deps): update dependency @vitejs/plugin-react-swc to v3.7.0
  • fix(deps): update dependency typescript to v5.5.4
  • fix(deps): update dependency vite to v4.5.3
  • fix(deps): update react monorepo (@types/react, @types/react-dom, react, react-dom)
  • fix(deps): update tanstack-query monorepo to v4.36.1 (@tanstack/react-query, @tanstack/react-query-devtools)
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/build-and-deploy.yml
  • actions/checkout v3
  • pnpm/action-setup v2
  • JamesIves/github-pages-deploy-action v4
npm
package.json
  • @tanstack/react-query ^4.29.3
  • @tanstack/react-query-devtools ^4.29.3
  • @types/compression ^1.7.2
  • @types/express ^4.17.17
  • @types/node ^18.15.13
  • @types/react ^18.0.37
  • @types/react-dom ^18.0.11
  • @vitejs/plugin-react-swc ^3.3.0
  • compression ^1.7.4
  • cross-env ^7.0.3
  • express ^4.18.2
  • react ^18.2.0
  • react-dom ^18.2.0
  • sirv ^2.0.2
  • ts-node ^10.9.1
  • typescript ^5.0.4
  • vite ^4.3.1
  • vite-plugin-ssr ^0.4.115

  • Check this box to trigger a request for Renovate to run again on this repository

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.