···134134// ...
135135```
136136137137-Only the `user id` is necessary, why not just give the user id instead of the whole object? That will be our first simplification.
137137+Only the `user id` is necessary, why not just give the user id instead of the whole object? That will be our first simplification <OrderTag order={1} />.
138138139139-> Here is a classic responsibility leak I frequentely see. When you're developing a feature, you have the big picture but `UserBookmarks` and its local knowledge don't care about the user having a `user.address.line1` property.
139139+> We'll simplify at the very end, once we'll be finished with our CRC card.
140140141141-```tsx
142142-interface Props {
143143- userId: number
144144-}
145145-146146-export const UserBookmarks: FunctionComponent<Props> = ({ userId }) => {
147147-// ...
148148- const userBookmark = await fetch(`/users/${userId}/bookmarks`, {
149149- method: 'GET'
150150- })
151151-// ...
152152- const newBookmark = await fetch(`/users/${userId}/bookmarks`, {
153153- method: 'POST',
154154- body: JSON.stringify({ bookmark })
155155- })
156156-// ...
157157-```
141141+> Here is a classic responsibility leak I frequentely see. When you're developing a feature, you have the big picture but `UserBookmarks` and its local knowledge don't care about the user having a `user.address.line1` property.
158142159143## The secret sauce
160144···176160 responsabilities={[
177161 "Display user bookmarks",
178162 "fetching bookmarks",
179179- "handling async processes",
163163+ "handling async processes (loading, error)",
180164 "handling add bookmark modal visibility",
181165 ]}
182166 collaborators={["Home.tsx"]}
···184168185169### The ugly responsability
186170187187-The main problem I see in the `UserBookmarks` component is not about the component itself, it's more on one of its children: `TilesSkeleton`. It's doing a good job for the user experience but it's asking too much for the parent to be able to use it: `UserBookmarks` doesn't care about animating the skeleton.
171171+The main problem I see in the `UserBookmarks` component is not about the component itself, it's more on one of its children: `TilesSkeleton`. It's doing a good job for the user experience but it's asking too much for the parent to be able to use it: `UserBookmarks` doesn't care about animating the skeleton. <OrderTag order={2} />
188172189173```tsx
190174const tilesAnimation = gsap.to({
···203187 responsabilities={[
204188 "Display user bookmarks",
205189 "fetching bookmarks",
206206- "handling async processes",
190190+ "handling async processes (loading, error)",
207191 "handling add bookmark modal visibility",
208192 "⚠️ Defining TilesSkeleton animation",
209193 ]}
210194 collaborators={["Home.tsx"]}
211195/>
212196213213-It must become
197197+## Simplification
198198+199199+### <OrderTag order={1} /> only necessary property
200200+201201+```tsx
202202+interface Props {
203203+ userId: number
204204+}
205205+206206+export const UserBookmarks: FunctionComponent<Props> = ({ userId }) => {
207207+// ...
208208+ const userBookmark = await fetch(`/users/${userId}/bookmarks`, {
209209+ method: 'GET'
210210+ })
211211+// ...
212212+ const newBookmark = await fetch(`/users/${userId}/bookmarks`, {
213213+ method: 'POST',
214214+ body: JSON.stringify({ bookmark })
215215+ })
216216+// ...
217217+```
218218+219219+### <OrderTag order={2} /> not responsible about the animation
214220215221```tsx
216222// removing the magic number at the same time