문제

As the title suggests.

I want to trigger an event by clicking the element.

In JSX, onClick works well, but somehow it just dead in raw JavaScript.

React.DOM.button({ type: 'button' }, { onClick: this.handleClick }, 'js button')

What may be the issue?

see demo

도움이 되었습니까?

해결책

All your key-value pairs should be in one object, as the first argument. The rest of the arguments are for children.

React.DOM.button({ type: 'button', onClick: this.handleClick }, 'js button');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top