You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on an application that is taking in some XML and essentially generating a large tree of React components from this. The input XML can be several megabytes large, but the output is mostly static, except for some small parts like popover elements that need to run on the client.
The transformation happens in a react component:
<XMLTransformerinput={str}/>
If I want to accept the XML via post and generate a server-rendered page from it, what's the best approach to take? How do I hydrate the resulting tree exactly? At the moment I have this:
exportasyncfunctionaction({
request,}: Route.ActionArgs){constformData=awaitrequest.formData();return{input: formData.get("input")};}exportdefaultfunctionHome({
actionData
}: Route.ComponentProps){return(<main><Formmethod="post"><textareaname="input"rows={10}placeholder="Enter your XML here"defaultValue={input}></textarea><buttontype="submit">Submit</button></Form><XMLTransformerinput={input}/></main>);}
How would I move most of the rendering to the server and reduce load on the clients? At the moment all the action does is return the string that was posted in the first, and if I understand it correctly most rendering still happens on the client.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm working on an application that is taking in some XML and essentially generating a large tree of React components from this. The input XML can be several megabytes large, but the output is mostly static, except for some small parts like popover elements that need to run on the client.
The transformation happens in a react component:
If I want to accept the XML via post and generate a server-rendered page from it, what's the best approach to take? How do I hydrate the resulting tree exactly? At the moment I have this:
How would I move most of the rendering to the server and reduce load on the clients? At the moment all the action does is return the string that was posted in the first, and if I understand it correctly most rendering still happens on the client.
Beta Was this translation helpful? Give feedback.
All reactions