docs: added migration guide for Medusa React (#3066)

* docs: added migration guide for Medusa React

* docs: fixed vale error
This commit is contained in:
Shahed Nasser
2023-01-19 16:59:49 +02:00
committed by GitHub
parent 296d6e229f
commit 7cafff14b9
22 changed files with 222 additions and 367 deletions
@@ -0,0 +1,58 @@
---
description: 'Actions Required for v4.0.2'
---
<!-- vale docs.HeadingColons = NO -->
# Medusa React: v4.0.2
<!-- vale docs.HeadingColons = YES -->
Version 4.0.2 of Medusa React introduces a new update in its dependencies which can lead to breaking changes.
## Overview
Medusa React previously required installing React Query v3 as a peer dependency. This version changes the peer dependency requirement to [Tanstack Query](https://tanstack.com/query/latest/docs/react/overview) - the updated version of React Query.
This requires additional actions related to installing the new dependency and changing imports.
---
## Actions Required
### Update Medusa Dependencies
To update to the latest version of Medusa React, run the following command in your custom storefront or admin to update both Medusa React and the core package:
```bash
npm update medusa-react @medusajs/medusa
```
### Uninstall React Query v3
As React Query v3 is not required as a peer dependency anymore, uninstall it from your custom storefront or admin:
```bash npm2yarn
npm remove react-query
```
### Install Tanstack Query
Run the following command to install Tanstack Query:
```bash npm2yarn
npm install @tanstack/react-query
```
### Update Imports
Across your custom storefront or admin project, change all imports from `react-query` to `@tanstack/react-query`.
For example, update the import for `QueryClient` where you use it with Medusa Provider:
```ts
import { QueryClient } from "@tanstack/react-query"
// this remains the same
const queryClient = new QueryClient()
```
@@ -0,0 +1,9 @@
{
"position": 2,
"collapsed": true,
"link": null,
"label": "Medusa React",
"customProps": {
"sort": "desc"
}
}