Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions examples/react/shadow-dom/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,29 @@ import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import { DogList } from './DogList'

const appRoot = document.getElementById('root')
if (!appRoot) throw new Error('Missing #root element')

if (appRoot) {
const queryClient = new QueryClient()
const shadowRoot = appRoot.attachShadow({ mode: 'open' })
const root = ReactDOM.createRoot(shadowRoot)
const queryClient = new QueryClient()
const shadowRoot = appRoot.attachShadow({ mode: 'open' })
const root = ReactDOM.createRoot(shadowRoot)

root.render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<div
style={{
width: '100vw',
padding: '30px',
}}
>
<h2>Dog Breeds</h2>
<DogList />
</div>
<ReactQueryDevtools
initialIsOpen={false}
buttonPosition="bottom-left"
shadowDOMTarget={appRoot.shadowRoot!}
/>
</QueryClientProvider>
</React.StrictMode>,
)
}
root.render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<div
style={{
width: '100vw',
padding: '30px',
}}
>
<h2>Dog Breeds</h2>
<DogList />
</div>
<ReactQueryDevtools
initialIsOpen={false}
buttonPosition="bottom-left"
shadowDOMTarget={shadowRoot}
/>
</QueryClientProvider>
</React.StrictMode>,
)
Loading