/**
* title: 基本用法
* desc: 可增删的不定条数表单
*/
import React, { useRef } from 'react';
import useDynamicList from "../../useDynamicList";
// function Demo2(): JSX.Element {
// const dom = document.querySelector('body');
// const size = useSize(dom);
// return (
//
// try to resize the preview window
// dimensions -- width: {size.width} px, height: {size.height} px
//
// );
// }
export default () => {
const { list, remove, insert } = useDynamicList(['David', 'Jack']);
return (
<>
{
list.map((item, index) => {
return (
-
item: {item}
{
remove(index);
}}>-
{
insert(index + 1, "插入数据");
}}>+
);
})
}
{/* */}
>
);
};