Skip to content

Commit 735e869

Browse files
committed
feat: [utils] export mountComponent
1 parent 9bb1b73 commit 735e869

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/components/Toast/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import mountComponent from '../../utils/mountComponent';
2+
import { mountComponent } from '../../utils/mountComponent';
33
import { Toast } from './Toast';
44

55
function show(content: string, type: string, duration = 2000) {

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'intersection-observer';
22

33
export { default as clsx } from 'clsx';
44

5+
export { mountComponent } from './utils/mountComponent';
56
export { Avatar } from './components/Avatar';
67
export type { AvatarProps, AvatarSize, AvatarShape } from './components/Avatar';
78
export { Backdrop } from './components/Backdrop';

src/utils/mountComponent.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
33

4-
function mountComponent(Comp: React.ReactElement, root = document.body) {
4+
export function mountComponent(Comp: React.ReactElement, root = document.body) {
55
const div = document.createElement('div');
66
root.appendChild(div);
77

@@ -16,5 +16,3 @@ function mountComponent(Comp: React.ReactElement, root = document.body) {
1616

1717
return div;
1818
}
19-
20-
export default mountComponent;

0 commit comments

Comments
 (0)