() => {
const array = ['a', 'a', 'b', 'c', 'd', 'e', 'e', 'e']
const [arr, setState] = useState(array)
return (
<div>
<div>数组: {JSON.stringify(arr)}</div>
<hr />
<span
className="btn theme mr10"
onClick={e => {
setState(arr.deduplication())
}}
>
去重
</span>
<span
className="btn red"
onClick={e => {
setState(array)
}}
>
重置
</span>
</div>
)
}