• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

오류가 나요

20.01.14 14:31 작성 조회수 230

0

React.cloneElement(...): The argument must be a React element, but you passed null.
import React from 'react';
import { Form, Input, Button, List, Card, Icon } from 'antd';

const profile = () =>
{
    return(
                <div>
                   <Form style={{ marginBottom: '20px', border: '1px solid #d9d9d9', padding: '20px' }}>
                       <Input addonBefore="닉네임" />
                       <Button type="primary">수정</Button>

                   </Form>
                   <List
                    style={{marginBottom: '20px'}}
                    grid={{gutter: 4, xs: 2,md: 3}}
                    size="small"
                    header={<div>팔로워 목록</div>}
                    loadMore={<Button style={{width: '100%'}}>더 보기</Button>}
                    bordered
                    dataSource={['제로초', '바보','노드버드오피셜']}
                    rednerItem={item=>(
                        <List.Item style={{marginTop: '20px'}}>
                            <Card actions={[<Icon type="stop" />]}>
                                <Card.Meta description={item} /> 
                            </Card>
                        </List.Item>
                    )}
                    />
    
                    
                </div>
     
    )
}

export default profile;

해결방법좀 알려주세요.

답변 7

·

답변을 작성해보세요.

1

이부분 그냥 제 깃헙 2강 코드 복사하시는 게 좋을 것 같습니다.

0

Hea Nick님의 프로필

Hea Nick

질문자

2020.01.14

감사합니다.

깃허브에 있는 파일을 가져와서 해결됐습니다.

0

아 생각해보니 js 파일은 넣을 필요가 없네요. antd만 패키지json 버전 맞춰서 설치해주세요.

0

Hea Nick님의 프로필

Hea Nick

질문자

2020.01.14

CDN을 JS파일로 불러오는 방법을 잘 모르겠습니다.

0

antd를 node_modules에서 꺼내오지 마시고, cdn을 사용하세요. https://cdnjs.cloudflare.com/ajax/libs/antd/3.25.3/antd.js

0

Hea Nick님의 프로필

Hea Nick

질문자

2020.01.14

index.js:1 Fetch API cannot load file:///C:/Users/user/Desktop/NodeBird/ch1/front/node_modules/antd/lib/list/index.js. URL scheme must be "http" or "https" for CORS request. 

이러한 오류가 떠요.

0

저도 처음보는 에러입니다.

antd 버전을 제 package.json의 버전과 일치시키셔야 할 것 같습니다.

npm i antd@제 강좌 버전