Skip to content

Commit

Permalink
feat: [utils] export mountComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
akai committed Jan 16, 2021
1 parent 9bb1b73 commit 735e869
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/Toast/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import mountComponent from '../../utils/mountComponent';
import { mountComponent } from '../../utils/mountComponent';
import { Toast } from './Toast';

function show(content: string, type: string, duration = 2000) {
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'intersection-observer';

export { default as clsx } from 'clsx';

export { mountComponent } from './utils/mountComponent';
export { Avatar } from './components/Avatar';
export type { AvatarProps, AvatarSize, AvatarShape } from './components/Avatar';
export { Backdrop } from './components/Backdrop';
Expand Down
4 changes: 1 addition & 3 deletions src/utils/mountComponent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';

function mountComponent(Comp: React.ReactElement, root = document.body) {
export function mountComponent(Comp: React.ReactElement, root = document.body) {
const div = document.createElement('div');
root.appendChild(div);

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

return div;
}

export default mountComponent;

0 comments on commit 735e869

Please sign in to comment.