Comment

Comment by chvid

This is the corresponding code written in React using hooks:

    export const Counter = ({label, counterType, onClick}) => {
        const [counter, setCounter] = useState(0);
        return (
            <button onClick={() => {
                counterType == "Increment" && setCounter(counter + 1);
                counterType == "Decrement" && setCounter(counter - 1);
                onClick && onClick();
            }}>
                {label}: {counter}
            </button>
        );
    }
I think the case for PureScript React would be more convincing if the code you ended up with was loosely as concise as the above.
parent chvid 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton