4 ms·
As far as I'm concerned <a onClick="function('value')"> was bad because 'function' was a global variable reference. I don't think that's the case for React tho
by mtrimpe 12y ago
As far as I'm concerned <a onClick="function('value')"> was bad because 'function' was a global variable reference.
I don't think that's the case for React though so I'm not sure if the GP saw some other drawbacks in it (apart from the aesthetic of separating logic from presentation.)
- Bahamut 12y agoIn React, you would do <a onClick={this.props.foo('value')}> (for example) - JSX would interpolate that and set up the appropriate click binding, and the function is local to the component.