valtio/v2/migration-recipe
No description available
This recipe provides a collection of codemods to help you migrate your codebase to [Valtio v2](https://github.com/pmndrs/valtio/blob/main/docs/guides/migrating-to-v2.mdx). These codemods are designed to streamline the transition process by automating common code transformations due to behavioral changes in Valtio v2.
## Codemods Included
The following codemods are included in this recipe:
1. **Proxy Function Behavior Update**
Updates instances of `proxy(obj)` to use `deepClone` to ensure objects are deeply copied as in Valtio v1. This adjustment is necessary due to the change from a pure function in v1 to an impure function in v2 that modifies the original object.
2. **`useSnapshot` Behavior Adaptation**
Modifies the usage of `useSnapshot()` to be compatible with recent changes for better optimization with `useMemo` and the upcoming React compiler. This includes wrapping snapshot data with `use()` to ensure compatibility and performance.