Skip to content

Commit

Permalink
fix bug uselector ? Lets see
Browse files Browse the repository at this point in the history
  • Loading branch information
zyhou committed May 24, 2019
1 parent 4f2d985 commit 464e020
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions examples/simple/src/comments/PostQuickCreate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import { useSelector, useDispatch } from 'react-redux';
import { connect, useSelector, useDispatch } from 'react-redux';
import { makeStyles } from '@material-ui/styles';
import {
CREATE,
Expand Down Expand Up @@ -33,10 +33,9 @@ const useStyles = makeStyles({
form: { padding: 0 },
});

const PostQuickCreate = ({ onCancel, onSave }) => {
const PostQuickCreateView = ({ submitting, onCancel, onSave }) => {
const classes = useStyles();
const dispatch = useDispatch();
const submitting = useSelector(state => state.admin.loading > 0);

const handleSave = useCallback(
values => {
Expand Down Expand Up @@ -81,9 +80,13 @@ const PostQuickCreate = ({ onCancel, onSave }) => {
);
};

PostQuickCreate.propTypes = {
PostQuickCreateView.propTypes = {
onCancel: PropTypes.func.isRequired,
onSave: PropTypes.func.isRequired,
};

export default PostQuickCreate;
const mapStateToProps = state => ({
submitting: state.admin.loading > 0,
});

export default connect(mapStateToProps)(PostQuickCreateView);

0 comments on commit 464e020

Please sign in to comment.