use portal to recycle dom to achieve performance
yarn add react-recycle-dom
bind Provider at the top level of the recycle dom and use inside it with Portal.Item name in eveywhere
import {Provider, Portal} from "react-recycle-dom";
import React from 'react';
import Item from './Item';
function App() {
return (
<Provider
componentMap={{
Item,
}}
>
<Portal.Item color='blue' />
<Portal.Item color='red' />
</Provider>
);
}
export default App;
https://codesandbox.io/s/react-recycle-dom-i4di7
cd example/basicUsage
yarn start
- type
- demo
- test
- ci cd