| ▲ | dsego 2 hours ago | |||||||
Sorry for being pedantic, but the first example could be rewritten to extract the pattern into a higher level hook, eg useNotifications. One way to simplify components before reaching for store libraries. The reusable hook now contains all the state and effects and logic, and the component is more tidy. | ||||||||
| ▲ | altbdoor 3 minutes ago | parent | next [-] | |||||||
Working with multiple teams in a large project, hooks can be a nightmare to maintain. I see 7x layers deep of hooks, with no test cases to support them. Some of the side effects are not properly tested, and mocks that abstract away the whole implementation means the test case only works for certain scenarios. FWIW this scenario might be an outlier in large projects, considering how some developers prefer to "just wrap the hook in another hook, and not worry about its internals". | ||||||||
| ▲ | whizzter 2 hours ago | parent | prev [-] | |||||||
Far cleaner, how is testability though? | ||||||||
| ||||||||