dustmq

홍영란·2020년 4월 6일
0
export function getDeckCards(/*card*/) {
  return dispatch => {
    axios
      .get("http://localhost:4000/card/cardInfo")
      .then(res => {
        //console.log(res.data);
        dispatch(showCard(res.data));
      })
      .catch(error => {
        console.log(error);
      });
  };
}
const reducer = (state = initialState, action) => {
  switch (action.type) {
    case SHOW_CARD:
      return Object.assign({}, state, { cards: action.cards });
    default:
      return state;
  }
};
componentDidMount() {
    this.props.getDeckCards();
  }
...
<Link
component={RouterLink}
to={`/study/${cate_route}/${title}/${
cardIdArr[currentIdx - 1]}`}>
<Button variant="outlined">previous card</Button>
</Link>
profile
JavaScript를 공부하고 있습니다:)

0개의 댓글