I am building my Redux (NgRx) App with smart/dump components, but I'm struggling with deciding how "dumb" the dumb components should be...
For example, I have a smart component (posts
) which has a dumb component (post-list
), which contains dumb components (post
). Until here everything looks nice.
To display some buttons I need to know if the user is admin
or not and I would need to pass the property admin
all the way down from posts
to post
.
Can I connect the dumb component post
to the store and get it directly from the dumb component. Or is the component in this case anymore dumb?
It would look something like this:
private admin$: Observable<boolean>;
constructor(private store: Store<AppState>){
this.admin$ = this.store.let(isAdmin());
}
I think this would save a lot of redundancy. Is this good or bad practice?