question about polymorphic example #371
Replies: 4 comments 4 replies
-
The code: Button({color: colorState, text: textState, onclick: onclickState}) instantiates a |
Beta Was this translation helpful? Give feedback.
-
thanks but if you look at Button function definition, I didn't see val function applied to text and onclick. so how it works behind the scene. why we do val(color) but not the other two? |
Beta Was this translation helpful? Give feedback.
-
thank you both. could you further advise how the val function is related to this? it seems defined separately...how is it being used? const val = v => { |
Beta Was this translation helpful? Give feedback.
-
yes how it applies to color. for onclick, should it be onclick: onclick? I don't see the key of onclick: for it. |
Beta Was this translation helpful? Give feedback.
-
hi looking at the example below, is val function only used once (eg val(color)?)? what is below code trying to do?
Button({color: colorState, text: textState, onclick: onclickState})
Beta Was this translation helpful? Give feedback.
All reactions