Slate.js plugin | Error: The useSlate
hook must be used inside the <Slate> component's context.
#2271
-
Hi ! 🙂 I copied the
Do you have any idea why the Thanks for your help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey there - this is because you have two copies of Slate in use - one local, and one within Payload. Instead of installing a separate copy of You could also try making sure to match the Last thing, if you do want to have additional copies of Slate installed, you could write a Webpack alias to make sure that when you import Slate, it always points to the same copy of Slate. This is a React problem more than anything, with how it handles context / etc. But this should be what you need here. |
Beta Was this translation helpful? Give feedback.
Hey there - this is because you have two copies of Slate in use - one local, and one within Payload. Instead of installing a separate copy of
slate
/slate-react
, just use Payload's copies.You could also try making sure to match the
slate
andslate-react
versions exactly to what Payload uses internally in its ownpackage.json
.Last thing, if you do want to have additional copies of Slate installed, you could write a Webpack alias to make sure that when you import Slate, it always points to the same copy of Slate.
This is a React problem more than anything, with how it handles context / etc. But this should be what you need here.