What is the prefered way to handle transparently or with minimal boilerplate immutable props in mercury? By props I mean an object that you provide to the render function of a descendant component, so you can affect it without touching its state from the owner. I can always use separate arguments, but I prefer an object, because usually there are more than one or two values and also I like to mimic the h() api. A not pretty way is to use a memoized function, with a single cache "slot", which will return the props object, based on some primitive arguments. That is ok for the descendant which will receive the object argument, but not even close to transparent for the owner component. By transparent I mean at the level of how we handle/embed state.
What is the prefered way to handle transparently or with minimal boilerplate immutable
props
in mercury? Byprops
I mean an object that you provide to the render function of a descendant component, so you can affect it without touching its state from the owner. I can always use separate arguments, but I prefer an object, because usually there are more than one or two values and also I like to mimic theh()
api. A not pretty way is to use a memoized function, with a single cache "slot", which will return the props object, based on some primitive arguments. That is ok for the descendant which will receive the object argument, but not even close to transparent for the owner component. By transparent I mean at the level of how we handle/embed state.