pH200 / cycle-react

Rx functional interface to Facebook's React
MIT License
370 stars 18 forks source link

Web component variant #17

Closed kristianmandrup closed 5 years ago

kristianmandrup commented 9 years ago

Looks like this project/pattern could be easily ported to Polymer web components, which also have component states and life-cycle event handlers, props etc. How about that? Recently Polymer now supports ES2015 where you can define a Polymer component as a regular javascript class, very similar to a React component. All these component frameworks in the end converge to similar patterns and architecture :)

pH200 commented 9 years ago

Sounds cool. Can you get me some links/docs about defining a Polymer component as a JavaScript class?

kristianmandrup commented 9 years ago

Try searching Polymer ES2015 recipe or look for polymer starter kit plus ;) Also a recent talk at Google Polymer Conference, Amsterdam by Eric Bidel covering this.

kristianmandrup commented 9 years ago

Polymer element: Lifecycle and callbacks

https://www.polymer-project.org/1.0/docs/devguide/registering-elements.html

You can see a class example here:

https://github.com/kristianmandrup/polymer-starter-kit-plus/blob/master/app/elements/my-greeting/my-greeting.html

    class MyGreeting {
      beforeRegister() {
        this.is = 'my-greeting';
        this.properties = {
          greeting: {
            type: String,
            value: 'Welcome!',
            notify: true
          }
        };
      }
    }

    Polymer(MyGreeting);
pH200 commented 9 years ago

Cool. I'll dig into it later :)