Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
[Ember] 1on1 request: components & actions & structuring code in app #305
I have two components that I'm reusing throughout my app, in other components and in different routes. For example: a "favorite this!" button that's visible at
I'm starting to repeat code for these components' actions across different routes (
I'd like to meet with someone for a few minutes to a) double check my understanding of how actions work / are connected across components and routes; and b) see if there's a way to reduce some of the repetition I'm experiencing.
After discussing some options, we decided to go with injecting the store into the component to do the CRUD on the favorites join. Arguments for doing it this way:
Inject store into favorite button component Instead of sending action, toggle favorite (add/delete favorite record) directly from component Why this approach? After talking with @jrhorn, we decided this makes the most sense because: - component is used in multiple other components & routes - CRUD action involves adding/deleting a row from a join table - See ga-wdi-boston/capstone-project#305 (comment) for full details