Files
medusa-store/docs/content/advanced/backend/upgrade-guides/medusa-react/4-0-2.md

1.5 KiB

description
description
Actions Required for v4.0.2

Medusa React: v4.0.2

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 - 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:

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:

npm remove react-query

Install Tanstack Query

Run the following command to install Tanstack Query:

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:

import { QueryClient } from "@tanstack/react-query"

// this remains the same
const queryClient = new QueryClient()