alfonsogarciacaro / fable-react-sample

Fable React Sample with JSX and UseElmish
MIT License
14 stars 1 forks source link

App based on this sample #1

Open delneg opened 2 years ago

delneg commented 2 years ago

Although I'm still debugging issues happening in runtime (which is currently pretty painful because I have to build it in production & replace django template base.html filenames, but I'll figure it out) - you probably might be interested because it's a pretty complex code, using all sorts of Fable features, new & old. The app itself is a F# React frontend for a Django-based chat backend plugin, which was previously written in part js / part F#, but now is 100% F#. https://github.com/Bearle/django_private_chat2/pull/41 @alfonsogarciacaro

alfonsogarciacaro commented 2 years ago

This is nice @delneg! Thanks for letting me know! Do you mean you have already used JSX in a real Fable app? If so, can you please link to the file containing the Fable JSX code?

delneg commented 2 years ago

This is nice @delneg! Thanks for letting me know! Do you mean you have already used JSX in a real Fable app? If so, can you please link to the file containing the Fable JSX code?

Well, I'm working it out. Right now I'm having troubles debugging what seems like "react-chat-elements" library issues, because of the React v17 vs React v18 differences & changes, and the fact new Fable setup that it doesn't work with React < 18. But anyway, you can have a look at https://github.com/Bearle/django_private_chat2/blob/feat/full-fs/example/frontend/src/App.fs That's the main file that contains all the JSX as well as the Elmish loop

delneg commented 2 years ago

@alfonsogarciacaro I've fixed most of the issues, and the compiled app is included in the repo as "index.js" You can try it out following the steps in the README for the example app: https://github.com/Bearle/django_private_chat2/blob/feat/full-fs/example/README.md P.S. It can be python3.10 or newer,not necessarily python3.9 , and "localhost" won't work, only 127.0.0.1

alfonsogarciacaro commented 2 years ago

Nice that you made it work with React 18. We can try to adapt useElmish to React 17, but it's a bit difficult without the new hook.

Would it be ok to edit it the useElmish post to include a reference to your app?

delneg commented 2 years ago

Nice that you made it work with React 18. We can try to adapt useElmish to React 17, but it's a bit difficult without the new hook.

Would it be ok to edit it the useElmish post to include a reference to your app?

I don't know if it's necessary to backport useElmish to React 17, but just in case - can't the new hook be included in the useElmish itself, if it's a dependency ?

Also, regarding the reference to the app - it would be great! Although this piece of code is surely not the best example, it's something

alfonsogarciacaro commented 2 years ago

Also, regarding the reference to the app - it would be great!

Will do, thanks!

I don't know if it's necessary to backport useElmish to React 17, but just in case - can't the new hook be included in the useElmish itself, if it's a dependency ?

Ah, you're right! We can just polyfill the hook 😅 We can do that if there are other users that want to use Fable.React.UseElmish and cannot upgrade to React 18.