Giter Club home page Giter Club logo

Comments (11)

lewismoten avatar lewismoten commented on July 16, 2024

I've tracked down part of the problem. It appears that there is a difference between the development and production versions of React itself. React-Slick appears to only have problems with the non-minified version of React.

<!DOCTYPE html>
<html>
  <head>

    <!-- PRODUCTION WORKS-->
    <!--<script src="https://fb.me/react-0.13.2.min.js"></script> --> 

    <!-- DEVELOPMENT FAILS -->
    <script src="https://fb.me/react-0.13.2.js"></script> 

    <script src="/bower_components/react-slick/dist/react-slick.js"></script>

  </head>  
  <body>

    <div id="example">[loading...]</div>

    <script>
    React.render(
      React.createElement(Slider, null, 
        React.createElement('div', null, 'first')), 

      document.getElementById('example'));

    </script>

  </body>
</html>

from react-slick.

edoloughlin avatar edoloughlin commented on July 16, 2024

I'm seeing the same behaviour with react-slick 0.4.1 and react 0.13.3, with both the minified and unminified versions.

from react-slick.

vaclavh avatar vaclavh commented on July 16, 2024

I have same issue with react 0.13.2

from react-slick.

vaclavh avatar vaclavh commented on July 16, 2024

Better solution than using the dist file from installed package is to proper configure the webpack to require base slider.jsx file. Due the other issues with this configuration, this definition works for me in webpack.config.js as a new loaders entry:

{
        test: /\.jsx$/,
        loaders: ['babel']
}

from react-slick.

akiran avatar akiran commented on July 16, 2024

@vaclavh You needn't use dist files
If you are using webpack, you can do

var Slider = require('react-slick')

from react-slick.

vramana avatar vramana commented on July 16, 2024

I don't see this issue on latest release.

@vaclavh @lewismoten @edoloughlin Can you guys check this issue on the latest release ?

Alternatively clone this gist and https://gist.github.com/vramana/e6d040d0bd9f19ae6d72 and run npm start and report if you see any errors ?

from react-slick.

awartani avatar awartani commented on July 16, 2024

I see the issue when adding dynamic slide.

let arr = this.state.arr;
        arr.map((item, index)=><div key={item+index}><h3>{item}</h3></div>)

        return (
            <div>
                <Slider>
                    {arr}
                </Slider>

                <button onClick={this.addMore}>add more</button>
            </div>
        );

from react-slick.

vramana avatar vramana commented on July 16, 2024

@awartani Can you give more information ?? Are you using the dist files ?? Also can you post the complete log ?

Don't insert any keys slick automatically inserts keys for you.

from react-slick.

vramana avatar vramana commented on July 16, 2024

arr.map((item, index)=><div key={item+index}><h3>{item}</h3></div>)

@awartani It is a plain javascript error. Arrap.map returns a new array so you have use new variable to store it and put it inside the Slider

from react-slick.

awartani avatar awartani commented on July 16, 2024

Thanks @vramana, after fixing that, the issue is gone.

from react-slick.

vramana avatar vramana commented on July 16, 2024

@awartani You are welcome.

from react-slick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.