• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 React 게시판 redux 1강 질문

redux 1강 질문

3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 글쓴이
  • #9545

    이도아
    참가자

    Failed to compile.

    src\index.js
    Line 10:13: 'createStore' is not defined no-undef

    Search for the keywords to learn more about each error.

     

     

    이렇게 오류가 뜨는데 이유가 무엇일까요???

     

     

    1.  index.js 

     

    import {Provider} from 'react-redux';

    let store = createStore(()=>{return [{id : 0, name : '멋진신발', quan: 2}] });

    ReactDOM.render(
      <React.StrictMode>
        <BrowserRouter>
        <Provider store={store}>
        <App />
        </Provider>
        </BrowserRouter>
      </React.StrictMode>,
      document.getElementById('root')
    );

     

     

    2. Cart. js

     

    import React from 'react';
    import {Table} from 'react-bootstrap';
    import { connect } from 'react-redux';

    function Cart(props){
      return(
        <div>
        <Table responsive>
      <thead>
        <tr>
         <th>#</th>
         <th>상품명</th>
         <th>수량</th>
         <th>변경</th>
        </tr>
      </thead>
      <tbody>
        <tr>
         <td>1</td>
         <td>{props.state[0].name}</td>
         <td>Table cell</td>
         <td>Table cell</td>
        </tr>
        
      </tbody>
    </Table>  
        </div>
      )
    }

    function 함수명(state){
     return {
       state : state
     }
    }

    export default connect(함수명)(Cart);
    // export default Cart;

    #9548

    codingapple
    키 마스터

    createStore를 위에서 import 안해온듯요? 

    #9580

    이도아
    참가자

    그러네욤 감사합니당

3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠