Skip to content

Commit

Permalink
[FE/#15] Refactor : pipe 함수를 통해 상태변경
Browse files Browse the repository at this point in the history
  • Loading branch information
sungik-choi committed Jun 24, 2020
1 parent 7784ac6 commit 08f365a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions FE/src/components/Labels/Navigation/NewLabel/NewLabel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ const NewLabel = ({
}) => {
const classes = useStyles();

const changeTitleHandler = ({ target }) => dispatch(setLabelInfo({ title: target.value }));
const changeTitleHandler = ({ target }) => pipe(setLabelInfo, dispatch)({ title: target.value });

const changeDescriptionHandler = ({ target }) =>
dispatch(setLabelInfo({ description: target.value }));
pipe(setLabelInfo, dispatch)({ description: target.value });

const clickCreateButtonHandler = () => pipe(submitHandler, clickHandler)();

const setLabelColorHandler = () => pipe(setLabelColor, dispatch)();

return (
<Box className={classes.container} component={Paper} variant="outlined" p={2} mb={2}>
<Box mb={2}>
Expand Down Expand Up @@ -65,7 +67,7 @@ const NewLabel = ({
<ColorGenerateButton
backgroundColor={backgroundColor}
color={color}
setLabelColor={() => dispatch(setLabelColor())}
setLabelColor={setLabelColorHandler}
/>
</Grid>
<Grid item xs={3}>
Expand Down

0 comments on commit 08f365a

Please sign in to comment.