chenglou / react-tween-state

React animation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React 0.13 and es6 Classes

jmfurlott opened this issue Β· comments

Is it possible to use react-tween-state with the new class style? Can't use mixins anymore, so what would it take for this to work?

I think just moving the need for tweenQueue to be in state and instead put it on the class itself, and then adding this to the prototype somehow.

I implemented as a mixin that works here, you can even use it as a decorator with babel 5:

https://github.com/reapp/reapp-ui/blob/master/src/decorators/Tweenable.js

@Tweenable
class MyClass extends React.Component {}

πŸ‘

@natew this errors, as trying to assign getInitialState on a plain class is not supported at the moment.

@frederickfogerty If you use it with my pull request on this repo it should work, may be some bugs but it works for me.

Will have a look now πŸ‘

πŸ‘ Would also love to see this work without mixins. Component wrappers are a popular alternative that will not only work with ES6 classes, but also CoffeeScript, TypeScript, LiveScript, etc.

commented

πŸ‘

To be honest, we should all just use https://github.com/chenglou/react-motion. I'm moving all my tween-state code to it at the moment

commented

@frederickfogerty nice, will take a look. Thanks!

I think I'll keep this library as a mixin. React-motion already fills most of the transition needs and if the demand is high for normal easing, I'll implement it over there. This library's stable, and changing the API to use classes breaks too many existing call sites. Besides, React might move away from classes now.

Closing! Thanks for all the discussion. Go check React-motion! =)

React might move away from classes now.

This caught my interest as I teach React and want to make sure I'm up to date. I thought ES6 classes were enouraged. Did I miss an announcement somewhere?

Nah it's a might. So no news worth spreading for now. Check https://github.com/reactjs/react-future

Also: https://twitter.com/sebmarkbage/status/646473000749928448

Thanks! I gotta stay on top of these tweets. πŸ˜ƒ