Skip to content

How to support both Node and Cloudflare? #13636

Answered by sergiodxa
pvcnt asked this question in Q&A
Discussion options

You must be logged in to vote

Maybe you could do something like this (note I never tried)

import * as ReactDOMServer from "react-dom/server";

if ("renderToReadableStream" in ReactDOMServer) {
  // use renderToReadableStream
} else {
  // use renderToPipeableStream
}

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@pvcnt
Comment options

@sergiodxa
Comment options

Answer selected by pvcnt
@pvcnt
Comment options

@sergiodxa
Comment options

@pvcnt
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants