react library
So far I've seen Vue 2, Vue 3, Alpine, and Svelte pulled into Foundry. No one has yet been crazy enough to try react. So in the name of science... Yolo?
As someone who works in react land, I think it is dramatically overkill for 99% of foundry use cases. Using react for small forms or dialogs would pull in way too much overhead.
I would consider react if I was making something complicated and multi-step like a character creator where state management matters a lot more.
But the biggest thing I have against any of these frameworks is that by using them you lock other people's modules out from modifying your thing. A lot of modules add a very small piece of functionality to something and do so by injecting DOM into existing forms for instance. My understanding of React is that it gets super mad when the DOM diverges from the virtual DOM, so this kind of injection would be a no go.
23 Replies
Good call
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
When I first started working on stuff that was my instinct as well.
It felt dirty to go back to jQuery after so long...
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
But I've kinda gotten to the point where I like how simple this FE is. You can read and understand the Application class in like a day. And it's pretty elegant.
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
Right, at that point you've done a lot of extra work for possibly no benefit
So if you do want to use react, I'd suggest doing so for things which no other module would want to modify
Do you have anything in mind that's heavy enough to warrant state management and the like?
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
Instead of React, Preact might be an answer
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
The fun part is getting data to and from Foundry's Database
linking foundry's mutating understanding of the world 'state' with a react component state
I don't have enough experience with working with React outside of a fully react project to really know how to start with that
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
Kind of
for DocumentSheet, yeah, somehow the db updates call render(). But the default
Application
and FormApplication
don't have that wired up, which allows you to control when the application re-renders.Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
i.e. everyone calls
this.render
at the end of _updateObject
for a FormApplicationUnknown User•4y ago
Message Not Public
Sign In & Join Server To View
does react have a utility thing which lets you like 'bind' a component to an external object to use as a prop?
Unknown User•4y ago
Message Not Public
Sign In & Join Server To View
Stack Overflow
How to use external object in react?
A third party sent me this script. Basically,
include a script
call the object
onAuthorize will feedback data, then do something with data
Is it a way to integrate it with react? I think I need the
Interesting
oh this is ancient
Integrating with Other Libraries – React
A JavaScript library for building user interfaces
So I guess yeah, using whatever data as a prop
the output of
getData
is what's usually fed into the template that an Application rendersUnknown User•4y ago
Message Not Public
Sign In & Join Server To View