Hacker News new | ask | show | jobs
by mtrimpe 4098 days 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.)

1 comments

In 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.