3 ms·
Sure, but I would still like to see how I would use this in the context of a browser. How do I interact with existing JS libraries? How would I use it with Reac
by kristiandupont 9y ago
Sure, but I would still like to see how I would use this in the context of a browser. How do I interact with existing JS libraries? How would I use it with React or something else? How would I even call window.alert()?
- piaste 9y agoFor React, install the appropriate library[1] and then call the functions you need from the Fable.Helpers.React.* namespace. If you want to see a complete implementation of Fable + React in action, the canonical example is https://github.com/SAFE-Stack/SAFE-BookStore https://github.com/SAFE-Stack/SAFE-BookStore For alert(), you'll find it in Fable.Import.Browser.window.alert() (In case you're wondering, the Fable convention is that the Fable.Import.* namespace is used for pure JS bindings with no business code, while libraries with an actual translation layer are placed in the Fable.Helpers.* namespace.) [1] https://www.nuget.org/packages/Fable.React/ https://www.nuget.org/packages/Fable.React/