Does the SAFE stack integrate with React, Angular, etc?

web

#1

If so, does it have an opinion about which is the best framework for use with SAFE?

Are there any examples of SAFE integrated with React, Angular, etc?

Thanks


#2

Well, digging it a little deeper, I notice there are a lot of Nuget packages for Fable and Elmish with “React” in the name, but I did not find any with “Angular” or “Vue”, etc in the name. I guess that might answer my question.


#3

In general, react is prefered because this is the one Elmish used by default.

You can use any JavaScript framework with Fable but more work can be needed to get started.


#4

Fable Elmish is the FE in SAFE I think. Fable translates F# to Javascript. Elmish is an implementation of Model-View-Update (MVU), a strategy for structuring UIs. By default, FE uses React to render the DOM, not as a “framework”. Elmish replaces the traditional front-end framework with mainly just libraries. You can build your UI with types and functions with minimal non-transferrable knowledge (unlike frameworks). MVU is awesome and it totally changed my world for the better.

You can easily replace the Fable-Elmish part with frameworks like Angular, Vue, React + ? components, or whatever else. In any of these cases, (including Fable-Elmish) it is a separately deployed front-end part and it still has to communicate back to an API over standard XHRs.


#5

It’s important to remember that React is not a framework, it is just a View library. That’s why it perfectly fits to Elmish for outputting HTML.
Angular, on contrary, is a framework, which has it’s own mechanism for application state management instead of Elmish. It would be hard to replace just React with Angular, you would also need to replace Elmish.
And then all that becomes senseless :slight_smile: