Accessing Inertia via context api? #180
Replies: 2 comments
-
I generally think this would make sense. However, Inertia itself is a singleton, there's always only one instance, so from that perspective a setup like this would look odd.
|
Beta Was this translation helpful? Give feedback.
-
Gents, help me understand why you can't just call |
Beta Was this translation helpful? Give feedback.
-
I'm trying to split my javascript code down into multiple packages to share components between several applications.
When i try to use
Inertia.visit
inside one of these packages, it fails withthis.resolveComponent is not defined
. From looking into the source, I think this is something to do with having multiple instances of Inertia, and only the one created insideApp
has called init and set itself up correctly?Is there any way this root copy of Inertia could be shared with all child elements, possibly via the context api? Something like:
I'm thinking closer to how a lot of other react navigation libraries work, where if you attempt to use a link component outside of a router, you get an error about not having the correct context above it.
Beta Was this translation helpful? Give feedback.
All reactions