How to get antd to work with an application created using create-react-app?

I am new to reaction and antd.

I started a new responsive project using create-react-app. I installed antd (ant.design).

I tried DatePicker, adding import and adding it to my render, changing App.js as follows:

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';

import { DatePicker } from 'antd';

class App extends Component {
  render() {
    return (
      <div className="App">
        <div className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <h2>Welcome to React</h2>
        </div>
        <p className="App-intro">
          To get started, edit <code>src/App.js</code> and save to reload.
        </p>
        <DatePicker/>
      </div>
    );
  }
}

export default App;

On Chrome, this works, although the style is weird. In IE11, it does not load due to the start of a function with a function call (startsWith is not supported in IE11). However, the DatePicker demo on the ant.design website works in IE11.

It seems that for some reason I am missing some policies / old browsers. If I try to create an assembly and execute it, it will also have the same error.

, antd , IE11, , create-react-app?

0
1

-- .

, core-js es6, src/index.js:

import 'core-js/es6';

:

import 'core-js/es6/function';

, , , .

+2

Source: https://habr.com/ru/post/1677394/


All Articles