react library

CCalego9/3/2021
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.
CCalego9/3/2021
Good call
UUUnknown User9/3/2021
2 Messages Not Public
Sign In & Join Server To View
CCalego9/3/2021
When I first started working on stuff that was my instinct as well.

It felt dirty to go back to jQuery after so long...
UUUnknown User9/3/2021
Message Not Public
Sign In & Join Server To View
CCalego9/3/2021
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.
UUUnknown User9/3/2021
Message Not Public
Sign In & Join Server To View
CCalego9/3/2021
Right, at that point you've done a lot of extra work for possibly no benefit
CCalego9/3/2021
So if you do want to use react, I'd suggest doing so for things which no other module would want to modify
CCalego9/3/2021
Do you have anything in mind that's heavy enough to warrant state management and the like?
UUUnknown User9/3/2021
3 Messages Not Public
Sign In & Join Server To View
CCalego9/3/2021
Instead of React, Preact might be an answer
UUUnknown User9/3/2021
Message Not Public
Sign In & Join Server To View
CCalego9/3/2021
The fun part is getting data to and from Foundry's Database
CCalego9/3/2021
linking foundry's mutating understanding of the world 'state' with a react component state
CCalego9/3/2021
I don't have enough experience with working with React outside of a fully react project to really know how to start with that
UUUnknown User9/3/2021
Message Not Public
Sign In & Join Server To View
CCalego9/3/2021
Kind of
CCalego9/3/2021
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.
UUUnknown User9/3/2021
Message Not Public
Sign In & Join Server To View
CCalego9/3/2021
i.e. everyone calls this.render at the end of _updateObject for a FormApplication
UUUnknown User9/3/2021
4 Messages Not Public
Sign In & Join Server To View
CCalego9/3/2021
does react have a utility thing which lets you like 'bind' a component to an external object to use as a prop?
UUUnknown User9/3/2021
Message Not Public
Sign In & Join Server To View
CCalego9/3/2021
Interesting
CCalego9/3/2021
oh this is ancient
CCalego9/3/2021
So I guess yeah, using whatever data as a prop
CCalego9/3/2021
the output of getData is what's usually fed into the template that an Application renders
UUUnknown User9/3/2021
4 Messages Not Public
Sign In & Join Server To View