Skip to content

Instantly share code, notes, and snippets.

@YounglanHong
Created October 12, 2020 18:23
Show Gist options
  • Save YounglanHong/cb7946c407875885fe44569f4f148487 to your computer and use it in GitHub Desktop.
Save YounglanHong/cb7946c407875885fe44569f4f148487 to your computer and use it in GitHub Desktop.
import Card from "../components/Card";
import { connect } from "react-redux";
// 컴포넌트에서 필요한 데이터를 store에서 추출하여 객체 반환
function mapStateToProps(state) {
return {
cards: state.card.cards,
decks: state.deck.decks,
category: state.deck.category,
};
}
// connect로 연결된 컴포넌트에 store의 데이터를 props로 전달
export default connect(mapStateToProps)(Card);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment