Angular Component Design

If there are 2 filter types, say Simple and DatePicker filter, then have different Presentation Components coz they look different, but should they share the same Container Component? NO. Coz their data and actions are different so it makes more sense to have different container components for each of these filter types…

Another concern is where should the validation logic be put in, for instance say we want to remove the user entered text when validation on it fails…For this, it makes sense to keep this input in the Redux store so that the components remain Stateless, and hence, the store should be updated on every keypress ie on every change to the input element by the user…

This way the validation logic can stay in the stateful container component and when the validation fails, it can set the item value in store to empty and hence the stateless presentation component, which is subscribing to this property in the store will be notified and will update the UI…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s