Code Monkey home page Code Monkey logo

Comments (4)

aweary avatar aweary commented on May 18, 2024

There are other attributes React includes as well that are required for full compatibility. Specifically data-reactroot and data-reactid.

from rapscallion.

aweary avatar aweary commented on May 18, 2024

Also, the checksum is calculated from the final markup, making it difficult (impossible?) to actually efficiently stream (as its being processed) the correct response since the first chunk would contain data that requires all the markup to be parsed already.

from rapscallion.

divmain avatar divmain commented on May 18, 2024

I've been considering this, and here are my thoughts:

  • With Rapscallion, the checksum is not known until all rendering has completed.
  • If streaming, the root element has already made it to the client by the time the checksum can possibly be generated.
  • Fortunately, the checksum is not needed on the client until the DOM has completed loading and React is bootstrapped.
  • If the checksum were sent down in some format (global var wrapped in <script> tag, or attached to the DOM as a data- attribute somewhere), that value could be retrieved by the bootstrap code and attached to the corresponding DOM element.

It's a bit round-about, but it is the only way I can think of to make this happen. And if we provide a nice utility to easily inject this information into the DOM, and possibly even mutate the DOM by injecting a script that takes care of everything for you, then it becomes a very much smaller downside.

from rapscallion.

aweary avatar aweary commented on May 18, 2024

@divmain we can at least implement this with renderToString since it is buffered. PR incoming.

from rapscallion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.