@a2670392079/react-toolkit
v0.1.3
Published
some instrumental hooks and component for react
Downloads
16
Readme
React常用的一些hooks和component
hooks例如useAdditionState:
import React, {useMemo} from "react";
import useAdditionState from "react-utils";
// import Map from 'lib';
// ...
const components: React.FC = () => {
// 其他库中的对象;
const obj = useMemo(() => {
return Map({
container: 'test',
url: 'mapurl'
})
}, [])
const mapState = useAdditionState(obj);
return
<>
<div id="test"/>
{
// mapState行为与普通state一致
// <childComponent mapState={mapState} />
}
</>
}