Code Monkey home page Code Monkey logo

Comments (5)

mariusandra avatar mariusandra commented on July 28, 2024

Very strange. This does not seem to be the case with the demo. Can you demonstrate the bug?

from react-calendar-timeline.

momegas avatar momegas commented on July 28, 2024

Same problem here. Works only once per page refresh.

Has this been resolved in some way?

from react-calendar-timeline.

Sitethief avatar Sitethief commented on July 28, 2024

Has anyone managed to fix this yet? I have the same problem and I can't find a solution.

from react-calendar-timeline.

jlubben avatar jlubben commented on July 28, 2024

I figured a solution, but don't know why. If you install:
npm install --save-dev babel-plugin-transform-class-properties
and update the webpack to something like:

{
        test: /\.js$/,
        loader: 'babel-loader',
        exclude: /node_modules/,
        query: {
          presets: ['react', 'es2015'],
          plugins: ['transform-class-properties']
        }
}

it runs correctly.

Edit: this is due to the arrow notation that is being used.

from react-calendar-timeline.

mariusandra avatar mariusandra commented on July 28, 2024

@jlubben thank you for finding this! :)

We do use class properties in the code for this module, mainly the bound functions like this:

class Timeline extends Component {
    boundFunction = () => {
      return this.instanceProperty;
    }
}

When the library is built, all of the code is converted (transpiled) to regular ES5 via babel and can be imported anywhere without complications.

However if you use a build tool that supports module (previously jsnext:main) in package.json, your build tool will instead take the untranspiled code. Rollup and Webpack 2+ both do this.

If then your babel configuration is not set up like the library's, you may run into problems.

I personally use these presets:

{
   "presets": ["es2015", "stage-0", "react"],
}

Adding stage-0 (babel-preset-stage-0) automatically adds transform-class-properties and some other useful features. If that seems a bit too experimental for you, then just stage-2 is enough.

I added a note for this into the README

Closing the issue now. Feel free to reopen in case of problems!

from react-calendar-timeline.

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.