inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

리액트로 나만의 블로그 만들기(MERN Stack)

CKEditor 질문입니다... 제발 도와주세요 ㅠㅠ

해결된 질문

925

박인혁

작성한 질문수 23

0

import React, { useState } from "react";
import { useSelectoruseDispatch } from "react-redux";
import {
  Form,
  FormGroup,
  Label,
  Input,
  Button,
  Col,
  Progress,
from "reactstrap";
import CKEditor from "@ckeditor/ckeditor5-react";
// import ClassicEditor from "@ckeditor/ckeditor5-editor-classic/src/classiceditor";
// import { editorConfiguration } from "../../components/editor/EditorConfig";
// import Myinit from "../../components/editor/UploadAdapter";

const PostWrite = () => {
    const {isAuthenticated} = useSelector( (state=> state.auth )
    const {formsetValue} = useState({ title: ""contents: ""fileUrl: ""})
    const dispatch = useDispatch()

    const onChange = (e=> {
        setValue({
            ...form,
            [e.target.name] : e.target.value
        })
    }

    const getDataFromCKEditor = (eventeditor=> {
        console.log('editor')
    }

    const onSubmit = async(e=> {
        await e.preventDefault()
        const { titlecontentsfileUrlcategory } = form
    }

    return (
        <>
          {isAuthenticated ? (
            <Form onSubmit={onSubmit}>
              <FormGroup className="mb-3">
                <Label for="title">Title</Label>
                <Input
                  type="text"
                  name="title"
                  id="title"
                  className="form-control"
                  onChange={onChange}
                />
              </FormGroup>
              <FormGroup className="mb-3">
                <Label for="category">Category</Label>
                <Input
                  type="text"
                  name="category"
                  id="category"
                  className="form-control"
                  onChange={onChange}
                />
              </FormGroup>
              <FormGroup className="mb-3">
                <Label for="content">Content</Label>
                <CKEditor
                  // editor={ClassicEditor}
                  // config={editorConfiguration}
                  // onInit={Myinit}
                  // onBlur={getDataFromCKEditor}
                />
                <Button
                  color="success"
                  block
                  className="mt-3 col-md-2 offset-md-10 mb-3"
                >
                  제출하기
                </Button>
              </FormGroup>
            </Form>
          ) : (
            <Col width={50} className="p-5 m-5">
              <Progress animated color="info" value={100} />
            </Col>
          )}
        </>
    );
}

export default PostWrite

(38강입니다.)

PostWrite.js에서 

import CKEditor from "@ckeditor/ckeditor5-react"; 

코드를 통해 CKEditor불러와야 하는데 하단의 에러가 발생합니다.

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

라는 에러가 발생해서 구글에 검색해보니깐 

import CKEditor from "@ckeditor/ckeditor5-react";  

이 코드에서 import를 못해와서 발생하는거같습니다만...

package.json에서 @ckeditor/ckeditor5-react 정상적으로 설치되었음에도 불구하고 

왜 import를 못하는건지 도저히 모르겠습니다...

mongodb bootstrap react redux express nodejs

답변 1

1

싸플

https://www.inflearn.com/course/%EB%A6%AC%EC%95%A1%ED%8A%B8-%EB%B8%94%EB%A1%9C%EA%B7%B8-%ED%92%80%EC%8A%A4%ED%83%9D/news

(해결) 

(기존) import CKEditor from "~~" -> (변경) import {CKEditor} from "~~"

강의이후에 import  하는 방법이 바뀌었습니다. ㅠㅠ

새소식을 참고하시기 바랍니다. 

0

박인혁

오 공지에 있었네요.. 공지를 먼저 봤었어야 했네요 ㅠㅠㅠ 

해결했습니다 ㅎㅎㅎ 

npm run dev-watch 오류

0

76

1

npm i react-redex redux-saga react-router-dom connected-react-router bootstrap reactstrap dotenv 명령어 설치하면 에러날까요?

0

439

1

mongodb 자세히 알고 싶습니다

0

264

1

강의 듣으면서...포스트 맨도 안됩니다

0

246

1

혹시 gatsby 생성하는 명령어 하는지 알고 싶습니다

0

274

1

webpack 설정 문제입니다.

0

309

1

Category관련 질문

0

231

1

https://www.ssaple.net/ 블로그 접속이 되질 않아요.

0

311

1

리액트 버전 오류 나시는 분들 참고

0

480

1

react 18버전에서의 connected-react-router 가 설치가안됩니다

0

1068

1

jwt.sign() 에서의 질문입니다.

0

205

1

ssaple.net 접속이 안됩니다.

0

367

1

Media(Video) 파일 첨부관련 질문

0

296

1

페이지 Link를 이용한 페이지 이동이 안됩니다

0

337

1

webpack.config.js 설정

0

832

1

몽고db 사이트가 많이 바뀌어서

0

343

1

선생님 req에 아무것도 안들어오는데 혹시 뭐가문제일까요 ?

0

300

1

안녕하세요 강의 잘 보고 있습니다 질문 하나 있는데요 ..

0

1585

1

그대로 따라하였고 하루종일 reboot하는데 되지않습니다..

0

211

1

Encountered two children with the same key 에러..

0

864

1

강사님 redux에러 질문이요

1

243

2

선생님 왜 저는 백날해도 collapse 내용이 link아래로 갈까요?

0

349

2

postDetail scss 문제

0

233

3

강사님 포스트 디테일 부분을 똑같이 작성하였는데 이런 오류가 나서 도저히 방법을 모르겠습니다 ㅠㅠ

0

210

1