Hi,
Short version is I’m trying to understand how best to use React MUI (https://mui.com/), or any similar 3rd party UI components, with my own purescript code - react-basic / react-basic-hooks / react-halo (latest versions).
-
Are there existing FFI bindings for purescript somewhere for some React UI component library - or some relatively automated way to produce them from TS modules - that I havent found?
-
I’ve seen this: GitHub - doolse/purescript-react-mui: Purescript bindings for https://material-ui.com/ which has bindings for react (not react-basic, and is somewhat old (2019, purs 0.13.2 not 0.14, and MUI v3 rather than v5, bower and no spago, and react not react-basic).
But it does have a ‘synctypes’ subproject that seems to automatically create purescript bindings, which I might be able to use. -
I’ve seen this, which has some information about using Typescript libraries from Purescript (seems most 3rd party UI libraries will probably be TS) blog-posts/PureScript-React.md at master · xc-jp/blog-posts · GitHub
-
I could make an FFI library by hand, just implementing the things I need as I need them. But there are loads of components and an automated transformation process would be great, if a method to do that already exists somewhere.
-
Or, am I asking the wrong question - is there some better alternative I dont know?
Cheers,
Mike
–
Longer version with some context as to why I ask:
I’m new to purescript, working on a personal project (no CSS/UX design team, just me :).
I started with the purescript book. Then looked at halogen (after seing the realworld example). I like halogen as I think it will help me with a complex domain problem. But it seems people are rolling their own styled UI components. (For example, this discussion: Styling question · Issue #46 · thomashoneyman/purescript-halogen-realworld · GitHub).
I dont have a team or the expertise to write cross-platform styled UI components, and wanted to leverage something like existing React UI components.
So next I looked into purescript-react and purescript-react-basic + purescript-react-basic-hooks.
I tried upgrading the ‘realworld’ example for the latter to the latest versions of purs/preact/react & it seems to work OK other than some json parsing issues in the API (GitHub - intronic/purescript-react-realworld: A real-world application demonstrating PureScript and React).
(There seem to be a lot of purescript projects that havent been updated since ~2018 and dont work with latest purescript versions so this has been my first step when looking through libraries in pursuit.)
Doing that I realised there is also react-halo which seems best of both worlds - use 3rd party React components, plus react-basic-hooks & react-halo for my problem domain.
Hence now, looking at how to best use React UI libraries.