简体   繁体   English

创建反应应用程序和反应流畅

[英]create-react-app & react-slick

import React, { Component } from 'react';

import { Slider } from 'react-slick';

import Home from './Home.js';
import About from './About.js';

class App extends Component {


  render() {
    var settings = {
      dots:true,
    };
    return (
      <div className='app'>

        <div className='container'>
          <Slider {...settings}>
            <Home />
            <About />
          </Slider>
        </div>

      </div>
    );
  }
}


export default App;

Picture of errormessage 错误消息的图片

So I cant make my slider work... Even ready examples wont work. 因此,我无法使滑块正常工作。即使准备好的示例也无法正常工作。 Theres picture of error what react throws. 有错误反应的图片。 Im using create-react-app 我正在使用create-react-app

Try import Slider from 'react-slick'; 尝试import Slider from 'react-slick'; (remove the braces) (去掉大括号)

Actually the braces are used when you want to import something specific from the package in your case you can just: 实际上,当您要从包装中导入特定内容时,可以使用大括号,您可以:

import Slider from 'react-slick';

I hope that helps in understanding what you are doing as well :-) 我希望这有助于您了解自己在做什么:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM