Home / File/ render-to-string.js — react Source File

render-to-string.js — react Source File

Architecture documentation for render-to-string.js, a javascript file in the react codebase. 6 imports, 0 dependents.

File javascript BabelCompiler Entrypoint 6 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  acc17744_5cfd_dd66_b0fd_71ec47db5ef0["render-to-string.js"]
  80a4d9b0_ea35_ec8f_4f21_8a2085be082e["App.js"]
  acc17744_5cfd_dd66_b0fd_71ec47db5ef0 --> 80a4d9b0_ea35_ec8f_4f21_8a2085be082e
  0ed5d49a_8ea3_0b80_de56_5d5e1cbc4e72["App"]
  acc17744_5cfd_dd66_b0fd_71ec47db5ef0 --> 0ed5d49a_8ea3_0b80_de56_5d5e1cbc4e72
  ea6c61ad_b555_8796_c3e4_a78a8f5c0ffc["delays.js"]
  acc17744_5cfd_dd66_b0fd_71ec47db5ef0 --> ea6c61ad_b555_8796_c3e4_a78a8f5c0ffc
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  acc17744_5cfd_dd66_b0fd_71ec47db5ef0 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  860fcd5f_4dd1_15af_0c6d_0894e4c5dffb["server"]
  acc17744_5cfd_dd66_b0fd_71ec47db5ef0 --> 860fcd5f_4dd1_15af_0c6d_0894e4c5dffb
  7588c17d_1add_e045_8136_b5174c39d4b3["perf_hooks"]
  acc17744_5cfd_dd66_b0fd_71ec47db5ef0 --> 7588c17d_1add_e045_8136_b5174c39d4b3
  style acc17744_5cfd_dd66_b0fd_71ec47db5ef0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */

import * as React from 'react';
import {renderToString} from 'react-dom/server';
import App from '../src/App';
import {API_DELAY, ABORT_DELAY} from './delays';
import {performance} from 'perf_hooks';

// In a real setup, you'd read it from webpack build stats.
let assets = {
  'main.js': '/main.js',
  'main.css': '/main.css',
};

let textEncoder = new TextEncoder();

module.exports = function render(url, res) {
  let payload =
    '<!DOCTYPE html>' +
    renderToString(<App assets={assets} />) +
    '<script src="/main.js" async=""></script>';
  let arr = textEncoder.encode(payload);

  let buf = Buffer.from(arr);
  res.statusCode = 200;
  res.setHeader('Content-type', 'text/html');
  res.send(buf);
};

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does render-to-string.js do?
render-to-string.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in render-to-string.js?
render-to-string.js defines 1 function(s): module.
What does render-to-string.js depend on?
render-to-string.js imports 6 module(s): App, App.js, delays.js, perf_hooks, react, server.
Where is render-to-string.js in the architecture?
render-to-string.js is located at fixtures/fizz/server/render-to-string.js (domain: BabelCompiler, subdomain: Entrypoint, directory: fixtures/fizz/server).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free