Closed gls-manifold closed 1 month ago
This is as expected; it has been deprecated. Please see here: https://stately.ai/docs/migration#useinterpret-is-now-useactorref
useInterpret()
is now useActorRef()
Breaking change
The useInterpret()
hook, which is used to return an actorRef
("service" in XState v4), is renamed to useActorRef()
.
// ✅
import { useActorRef } from '@xstate/react';
const actorRef = useActorRef(machine); // or any other logic
// ❌ DEPRECATED
import { useInterpret } from '@xstate/react';
const service = useInterpret(machine);
XState version
XState version 5
Description
I try to use this hook link as in the example, but I get an error: _xstate_react__WEBPACK_IMPORTED_MODULE_1__.useInterpret is not a function
"xstate": "^5.8.0", "@xstate/react": "^4.1.1",
Expected result
Working hook
Actual result
_xstate_react__WEBPACK_IMPORTED_MODULE_1__.useInterpret is not a function
Reproduction
xstate/react
Additional context
No response