25.3.2 TagBoxContainer 만들기
이번에는 TagBox를 위한 컨테이너 컴포넌트인 TagBoxContainer를 구현해 봅시다.
containers/write/TagBoxContainer.js
import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; import TagBox from '../../components/write/TagBox'; import { changeField } from '../../modules/write'; const TagBoxContainer = () => { const dispatch = useDispatch(); const tags = useSelector(state => state.write.tags); const onChangeTags = nextTags => { dispatch( changeField({ key: 'tags', value: nextTags, }), ); }; return <TagBox onChangeTags={onChangeTags} tags={tags} />; }; export default TagBoxContainer;