News for hackers. Stuff that matters.
Re:How to write PureScript react components to replace JavaS... by lalaithion on Thursday June 25, 2020 @01:19PM (#23643005)
This is a closer comparison.

    mkCounter :: String -> (Int -> Int) -> Effect (ReactComponent {})
    mkCounter label op = do
      component "Counter" \props -> React.do
        counter /\ setCounter <- useState 0

        pure
          $ R.button
            { onClick: handler_ do
                setCounter op
            , children:
                [ R.text $ label <> ": " <> show counter ]
            }
now you can call

    mkCounter "Increment" (_ + 1)

There are no comments on this comment yet.