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

home2 게시판 React 게시판 데이터 전용 js파일에서 스테이트 선언을 할 수 있나요?

데이터 전용 js파일에서 스테이트 선언을 할 수 있나요?

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

    이무헌
    참가자

    import form_ocr_title from "../form_ocr_title"
    import { useState } from 'react';

    export default [

       
        { id:0,
          content:'스캐너 및 카메라를 컴퓨터와 연결한다.',
          pre_score:null,
          post_score:null,
          cur_score:null,
          description:null,
          title_id:form_ocr_title[0]

        },
        { id:1,
          content:'스캐너 드라이버를 설치한다.',
          pre_score:null,
          post_score:null,
          cur_score:null,
          description:null,
          title_id:form_ocr_title[0]

        },
        { id:2,
          content:'소프트웨어를 설치한다.',
          pre_score:null,
          post_score:null,
          cur_score:null,
          description:null,
          title_id:form_ocr_title[0]

        },
        { id:3,
          content:'스캐너의 구조를 안다.',
          pre_score:null,
          post_score:null,
          cur_score:null,
          description:null,
          title_id:form_ocr_title[1]

        },
        { id:4,
          content:'장치관리자를 이용한 스캔을 한다.',
          pre_score:null,
          post_score:null,
          cur_score:null,
          description:null,
          title_id:form_ocr_title[1]

        },
        { id:5,
          content:'카메라의 구조를 안다.',
          pre_score:null,
          post_score:null,
          cur_score:null,
          description:null,
          title_id:form_ocr_title[2]

        },
       
        { id:6,
          content:'동작 준비 상태를 확인한다.',
          pre_score:null,
          post_score:null,
          cur_score:null,
          description:null,
          title_id:form_ocr_title[2]

        },
        { id:7,
          content:'메인화면 구성을 안다.',
          pre_score:null,
          post_score:null,
          cur_score:null,
          description:null,
          title_id:form_ocr_title[3]

        },

     

    이런식으로 데이터를 보관하고 싶은데 다른 파일의 데이터를 스테이트화 시켜서 title_id 오브젝트에 할당하고 싶은데 방법이 있을 까요? 함수를 만들어서 선언해도 안되더라구요 ㅠㅠ

    #26929

    codingapple
    키 마스터

    리액트 use 어쩌구 문법들은 컴포넌트 안에서만 사용가능합니다 

    근데 굳이 state로 만들 필요는 없어보입니다 

    #26937

    이무헌
    참가자

    감사합니다!

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 호 / 개인정보관리자 : 박종흠