Skip to content

Conversation

@PatrickJS
Copy link

I need to replace TypeScript for Babel to keep the same build and remove all unneeded types. CounterApp has a lot more code because I didn't feel like recreating the connect decorator. I also didn't create Provider.

Todo:

  • Replace TypeScript for Babel with angular 2 plugins

@gaearon
Copy link
Contributor

gaearon commented Jul 8, 2015

Great job!
How would you pass state further down?

I definitely think this needs to be in a separate repo, like redux-angular-counter-example.

@PatrickJS
Copy link
Author

redux-angular2 might be better with the examples and abstractions like Angular's version of Provider and Connector. At the moment the logic for Connector is exposed in in CounterApp. To pass state down you do the same thing as react with props (in Angular2 you don't need the props namespace). If we have a data structure like this

var state = {
  "person": {
     "address": {
        "city": sf,
        "zipcode": 94102
      }
   }
}

the components would look like this

<root></root>
  // inside <root>
  <app [state]="state"></app>
    //  inside <app>
    <person [person]="state.person"></person>
      // inside <person>
      <address [address]="person.address"></address>
        // inside <address>
        <span>{{ address.city }} {{ address.zipcode }}</span>

the ON_PUSH means that the component will only be updated if the prop references changed

changeDetection: ON_PUSH

we don't have this on CounterApp because it's prop is redux and since redux doesn't change each time there is a change then it's ChangeDetection is default to always check (will be fixed with Provider).

@gaearon
Copy link
Contributor

gaearon commented Aug 6, 2015

Thanks for the effort! There's ng-redux now so I don't think we need it as a full-featured example inside Redux repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants