Skip to content

Commit

Permalink
feat(jsx/dom): export createRoot and hydrateRoot from jsx/dom/client …
Browse files Browse the repository at this point in the history
…as default (#2929)
  • Loading branch information
usualoma committed Jun 12, 2024
1 parent 75663ff commit 668a07c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/jsx/dom/client.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsxImportSource ../ */
import { JSDOM } from 'jsdom'
import { createRoot, hydrateRoot } from './client'
import DefaultExport, { createRoot, hydrateRoot } from './client'
import { useEffect } from '.'

describe('createRoot', () => {
Expand Down Expand Up @@ -117,3 +117,12 @@ describe('hydrateRoot', () => {
expect(() => root.render(App2)).toThrow('Cannot update an unmounted root')
})
})

describe('default export', () => {
;['createRoot', 'hydrateRoot'].forEach((key) => {
it(key, () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect((DefaultExport as any)[key]).toBeDefined()
})
})
})
5 changes: 5 additions & 0 deletions src/jsx/dom/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,8 @@ export const hydrateRoot = (
root.render(reactNode)
return root
}

export default {
createRoot,
hydrateRoot,
}

0 comments on commit 668a07c

Please sign in to comment.