Giter Site home page Giter Site logo

Comments (5)

jamesward avatar jamesward commented on July 29, 2024

It sounds like you just need to load a global from a different WebJar. But I don't fully understand the problem.

from react.

aantono avatar aantono commented on July 29, 2024

What webjar would you suggest?
Based on the discussion in the fb issue (linked to here) it seems like the problem is that during the creation of the js files (browserify or what else is being used) the ReactDOMServer reference is not exported (unlike ReactDOM does)
Can that be fixed during the preparation of the js files?

from react.

Download avatar Download commented on July 29, 2024

Yes, the problem is that only React and ReactDOM objects are exposed to global, but not ReactDOMServer. So if you don't have access to require (all systems but Node basically), there is no way (any more) to use renderToString since it has moved from React to ReactDOMServer.

I get that you want to minimize the API footprint/surface area. We don't want a whole bunch of objects in global. But what about a middle ground where we expose ReactDOMServer via one of the objects that are already in global?

E.g. I'd love to be able to do this:

var ReactDOMServer = ReactDOM.ReactDOMServer;

It would be a single line of code in the React codebase and would make it much simpler to use React on e.g. Nashorn. As it stands we are forced to either polyfill the CommonJS module system or use Node+Broswerify+Babel / Node+Webpack+Babel etc combinations to build a bundle file that does expose ReactDOMServer.

from react.

jamesward avatar jamesward commented on July 29, 2024

Can that be fixed during the preparation of the js files?

There isn't any preparation for this WebJar. The upstream zip is downloaded and then repackaged into a WebJar.

I'm not sure if there is anything that can be done in the WebJar. But I'll leave this open since I don't fully understand the issue.

from react.

Download avatar Download commented on July 29, 2024

It is my understanding that this pull request will fix this issue. So I think this one can be closed.

from react.

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.