Add useActionCreator hook

This commit is contained in:
Jordan Eldredge 2020-09-09 22:30:06 -07:00
parent 3f34e240a3
commit eaac55e70d
2 changed files with 13 additions and 6 deletions

View file

@ -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;
}