paf31 / purescript-thermite

A simple PureScript wrapper for React
MIT License
350 stars 55 forks source link

What is R.p' in the Getting Started Documentation? #105

Closed jstr045329 closed 5 years ago

jstr045329 commented 5 years ago

I entered the example code from the Getting Started guide (top level README.md) into a new file. Around line 20, there is a statement like this:

render :: T.Render State _ Action
render dispatch _ state =
    [ R.p' [ R.text "Value: "
            , R.text $ show state.counter
            ]
    , R.p'  [ R.button  [RP.onClick \_ -> dispatch Increment ]
                        [ R.text "Increment" ]
            , R.button  [RP.onClick \_ -> dispatch Decrement ]
                        [ R.text "Decrement" ]
            ]
  ]

R.p' results in an unknown symbol error. Obviously this is supposed to be replaced by something else, but what?

athanclark commented 5 years ago

I'll try to make it a complete example - I think it's just missing an import, or it's using out-of-date code from the react library. Sorry about that, I should have something better soon.

athanclark commented 5 years ago

@jstr045329 Hey so I think you just must be a bit new to the whole ecosystem - the document itself tries to render itself as self-referential and a complete source of info. If you check out the import declarations above the line you're having issues with, it imports the React module as import React.DOM as R, which makes the call to R.p' accessible in the current scope. I hope this helps! Btw, I just released a new version that should work with purescript v0.13.2. Thanks!