elmish / react

Elmish React extensions for writing SPA and Native apps
https://elmish.github.io/react
Other
104 stars 21 forks source link

Documentation not aligned with API #48

Closed marcellourbani closed 4 years ago

marcellourbani commented 4 years ago

Description

I followed the instructions in the sample code, they don't compile

Either the docs need to be updated or semantic versioning has been broken

Repro code

module R = Fable.React

I created a sample repo

Expected and actual results

Should compile

Related information

MangelMaxime commented 4 years ago

In a previous version of Fable.React we reworked the API structure.

In general, I think people use open Fable.React because it will AutoOpen some of the modules etc. but you will not have the prefixed API style.

If you prefer the prefixed API style you can do module R = Fable.React.Standard

@et1975 We need to decide which API we prefer to show in Elmis docs

marcellourbani commented 4 years ago

@MangelMaxime I don't have any preference, I'm a total beginner with a 2 day F# course and a few hours mocking around.

I do have a strong opinion a "getting started" article should work OOTB.

image

PS: for the record, module R = Fable.React.Standard works for the div but not the str. Looks like it's in Fable.React.Helpers, with a second prefix attached to that does compile

Pushed that to newfix, which does compile and run (completed the other branch too, just in case)

MangelMaxime commented 4 years ago

True, then we should just avoid the alias style because now the API is split between several modules. It is hidden when using open Fable.React because they are marked with [<AutoOpen>]

et1975 commented 4 years ago

@marcellourbani Thanks for pointing it out! I agree with @MangelMaxime , and switching to open Fable.React should work for new and old React DSL, so there's no downside. if you want to open a PR for this, please make it to v3.x branch and include just the affected documentation script, nothing else.

Would be great to have the samples updated like this as well, if you're up to it.