mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-24 18:47:44 +00:00
Add useActionCreator hook
This commit is contained in:
parent
3f34e240a3
commit
eaac55e70d
2 changed files with 13 additions and 6 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import * as React from "react";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useActionCreator } from "./hooks";
|
||||
import * as Actions from "./redux/actionCreators";
|
||||
import { SHOW_UPLOAD } from "./constants";
|
||||
import UploadIcon from "./components/icons/UploadIcon";
|
||||
|
|
@ -7,10 +8,7 @@ import CloseIcon from "./components/icons/CloseIcon";
|
|||
|
||||
function UploadButton() {
|
||||
const uploadViewOpen = useSelector((state) => state.uploadViewState);
|
||||
const dispatch = useDispatch();
|
||||
function toggleUploadView() {
|
||||
dispatch(Actions.toggleUploadView());
|
||||
}
|
||||
const toggleUploadView = useActionCreator(Actions.toggleUploadView);
|
||||
if (!SHOW_UPLOAD) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue