fixtures/fizz/server/render-to-string.js JAVASCRIPT 35 lines View on github.com → Search inside
1/**2 * Copyright (c) Meta Platforms, Inc. and affiliates.3 *4 * This source code is licensed under the MIT license found in the5 * LICENSE file in the root directory of this source tree.6 *7 */89import * as React from 'react';10import {renderToString} from 'react-dom/server';11import App from '../src/App';12import {API_DELAY, ABORT_DELAY} from './delays';13import {performance} from 'perf_hooks';1415// In a real setup, you'd read it from webpack build stats.16let assets = {17  'main.js': '/main.js',18  'main.css': '/main.css',19};2021let textEncoder = new TextEncoder();2223module.exports = function render(url, res) {24  let payload =25    '<!DOCTYPE html>' +26    renderToString(<App assets={assets} />) +27    '<script src="/main.js" async=""></script>';28  let arr = textEncoder.encode(payload);2930  let buf = Buffer.from(arr);31  res.statusCode = 200;32  res.setHeader('Content-type', 'text/html');33  res.send(buf);34};

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.