This post demonstrates how to take over a React component using PureScript. It’s meant for beginner-to-intermediate PureScript devs and omits no code along the way. It’s the first of three articles:
- Taking over individual components with PureScript React & React Basic
- Doing the same with Halogen
- Sharing more complex information like Redux stores
If enjoyed the article & you know folks with a React codebase who are also interested in functional programming, consider sharing it with them! It’s my hope that these sorts of pieces can help teams feel more confident transitioning to PureScript with their existing applications.
2020 Update: Earlier in the year this article hit the front page of HN for a day. Plenty of people there viewed the article through the lens of Hooks, which at the time the article didn’t talk about at all. I decided to update the article to use
react-basic-hooks throughout and use some conveniences that @andys8 put together with craco-purescript-loader in his create-react-app-purescript project. I also thought it would be nice to link to purescript-react-realworld in the article to show PureScript in a more realistic setting.
The updated post is up on the site: