Skip to content

Polymer 2 demo? (and Polymer 3?) #113

@rjcorwin

Description

@rjcorwin

Hi @tur-nr

Thanks so much for the very interesting library. I'm writing my very first open source Polymer + Redux app that will be going to production in Kenya on thousands of tablets in schools and it's very timely that @tjsavage mentioned this library in his Chrome Dev Summit talk.

I did pass by this library when I was doing my original research but being so green I had a hard time understanding how the pieces fit together. After finding an example of how to use Redux in Vanilla JS, I realized that part was dead simple and then had to figure out how to pass state up with some standards around emitting events and attaching payload to event.details and then started using Object.apply(element, state) to properties that have reflectToAttribute: true.

Everything seems to be work fine and dandy but I'm still interested in the ways that this library can help reduce boilerplate. Is the key proposition of this library the following example at https://tur-nr.github.io/polymer-redux/docs?

class DemoApp extends ReduxMixin(Polymer.Element) {
  // ...

  static get properties() {
    return {
      message: {
        type: String,
        statePath: 'message' // Binds state, "Hello, World!"
      }
    };
  }
}

If I understand correctly this saves us from writing the boilerplate of..

  1. You don't have to write boilerplate of subscribing a component to the store because it's passed in via ... extends ReduxMixin(Polymer.Element).
  2. You don't have to write the boilerplate of applying state to element attributes/properties because element properties are binded to location in the store via statePath: 'message' in the element properties declaration.

Basics aside, I'd love to see the demo code for this updated to Polymer 2 and the impeding Polymer 3 release. Potentially, the demo could actually be the HN Polymer example. I mentioned this in that in the HN Polymer issue queue Polymer/hn-polymer-2#14.

Lastly, for the newbies like myself, perhaps a demo using Redux without polymer-redux so we can compare and contrast? That could help for folks like me who are still groking Redux and Web Components to jump to using Redux, Polymer, and Polymer-Redux.

Thanks again!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions