I have trouble understanding using monads here.
Przemysław Lib

Hi, thank you for your feedback.

The composability of monads in the context of React make it easier to treat React components as nodes in a graph where connections represent a “sends data to” relationship. React components always produce a result (a form for example produces data as output when the user clicks on “Submit”, an input box produces text as the user types, and so on), but the same components usually accept as input the “initial data” they need to process (the same form requires the initial values of the various fields, for example).

The strong typing guarantee is very present here: although the same functionality is indeed available in JavaScript, the strong typing here guarantees that when binding components the output of the one component has the same type as the input of the other. This means that components cannot be bound together (via the bind operator) unless their types correctly match. This saves a developer from quite a lot of small, but annoying and easy to make, mistakes.

Like what you read? Give Giuseppe Maggiore a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.