What do you think about ‘onNav’ as a factory of functions w/ memoization?
Arturo Muñoz de la Torre
1

I was also thinking about memoization of partially applied functions. But I’m not sure if it’s an efficient solution, especially if data is changing frequently. You can end up with thousands of memoized functions here and there if you have a normal size app. The other option is to kick out memoized function when you are going to construct a new one with different arguments, when the props has been changed.

I agree that presentational components should be totally unaware of the context. It’s probably an ideal case, but components must be composed in a way that parents doesn’t change the behavior of the children. For example given that Button component inside of Nav component, my example is not quite good in terms of structuring. I think Nav should have its own special type of a button which composes with generic Button component. This way NavButton would own some special behavior which makes sense only in a context of navigation. But this also may lead to many components which doesn’t do much, just messing with props. So probably memoization is a better approach when there’s no practical benefit of creating context aware component.