You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I am mounting a react component from turbo, is it possible to customize the “root” wrapper?
for example, I’m using chakra ui component library. To use chakra with turbo mount, I would need to wrap every component in the ChakraProvider. It would be nice to not need to do that.
The text was updated successfully, but these errors were encountered:
// Add this file as, for example, utils/chakraPlugin.ts// Then replace `import { registerComponent } from "turbo-mount/react";`// with `import { registerComponent } from "/utils/chakraPlugin";`import{buildRegisterFunction,Plugin,TurboMount}from"turbo-mount";import{ComponentType,createElement}from"react";import{createRoot}from"react-dom/client";import{ChakraProvider}from"@chakra-ui/react";constplugin: Plugin<ComponentType>={mountComponent: (mountProps)=>{const{ el, Component, props }=mountProps;constroot=createRoot(el);root.render(createElement(ChakraProvider,null,createElement(Component,props)));return()=>{root.unmount();};},};constregisterComponent=buildRegisterFunction(plugin);export{TurboMount,registerComponent};exportdefaultplugin;
If I am mounting a react component from turbo, is it possible to customize the “root” wrapper?
for example, I’m using chakra ui component library. To use chakra with turbo mount, I would need to wrap every component in the ChakraProvider. It would be nice to not need to do that.
The text was updated successfully, but these errors were encountered: