diff --git a/src/index.js b/src/index.js index 2258231..eff31a0 100644 --- a/src/index.js +++ b/src/index.js @@ -2,8 +2,10 @@ import {getQueriesForElement, prettyDOM} from 'dom-testing-library' export * from 'dom-testing-library' const mountedContainers = new Set() -export const render = (Component, {target = document.createElement('div'), ...options} = {}) => { - document.body.appendChild(target) +export const render = (Component, {target, ...options} = {}) => { + if (!target) { + target = document.body.appendChild(document.createElement('div')) + } const component = new Component({ ...options,