Lib Mode: When use the Component prop (config option), pass Route.ComponentProps to the component #13162
Replies: 3 comments 1 reply
-
As noted by @rossipedia, let's also do this for |
Beta Was this translation helpful? Give feedback.
-
Is this even possible? The framework mode relies on a very specific project structure sprinkled with codegen magic, which is incompatible with library mode being shoved into whatever codebase. |
Beta Was this translation helpful? Give feedback.
-
I was interested in getting this to work for an experiment I'm working on (attempting to make a project that works in both framework mode and library mode), and I got a very very hacky version of this to work. This is nowhere near good enough to PR yet, but it Works On My Machine™️: In order to make this work, I had to remove the optimization that pre-renders the |
Beta Was this translation helpful? Give feedback.
-
When you're using React Router in library mode, you can configure the router with routes that have an element or a component. I think it would make a lot of sense for the component to receive the same component props that you get when using React Router in framework mode to better align these two ways of using React Router.
For example:
As for types, I'm not sure whether there's a good way to make that work, but I expect there is. I just think it would be nice to align these ways of building React Router apps.
Beta Was this translation helpful? Give feedback.
All reactions