@21epub/resource-lib 中文文档教程
resource-lib
Usage
import React from 'react'
import {
AssetsRecoilRoot,
AssetsModal,
useAssetsModalState,
} from '@21epub/resource-lib'
const Button = () => {
const [assetsModalState, dispatch] = useAssetsModalState({
visible: false,
type: 'image',
})
return (
<button onClick={() => dispatch({ visible: !assetsModalState.visible })} />
)
}
const App = () => (
<AssetsRecoilRoot>
<AssetsModal getPath={() => ''} />
<Button />
</AssetsRecoilRoot>
)
export default App
resource-lib
Usage
import React from 'react'
import {
AssetsRecoilRoot,
AssetsModal,
useAssetsModalState,
} from '@21epub/resource-lib'
const Button = () => {
const [assetsModalState, dispatch] = useAssetsModalState({
visible: false,
type: 'image',
})
return (
<button onClick={() => dispatch({ visible: !assetsModalState.visible })} />
)
}
const App = () => (
<AssetsRecoilRoot>
<AssetsModal getPath={() => ''} />
<Button />
</AssetsRecoilRoot>
)
export default App
更多