Closed willmartian closed 3 years ago
I am working on a Preact app using server side rendering and htm.
In the component below, I can't get the onClick handler to fire when clicked.
const HistoryListItem = ({ historyItem, key }) => { const handleClick = () => { console.log("test") } return html` <li onClick=${handleClick}> ${historyItem.toString()} </li> `; }
I have tried onClick=${() => handleClick()} and onclick as well. I am coming from React, so I may be missing something super obvious. Any idea what is going on?
onClick=${() => handleClick()}
onclick
It depends on what is html function here.
html
It turns out I just didn't understand the implications of server side rendering! My error.
I am working on a Preact app using server side rendering and htm.
In the component below, I can't get the onClick handler to fire when clicked.
I have tried
onClick=${() => handleClick()}
andonclick
as well. I am coming from React, so I may be missing something super obvious. Any idea what is going on?