Skip to main content

entry.client.tsx

还没翻译译自英文(reactrouter.com)本页 9 段都还没译

entry.client.tsx

Framework

Summary

Info

This file is optional

This file is the entry point for the browser and is responsible for hydrating the markup generated by the server in your server entry module

This is the first piece of code that runs in the browser. You can initialize any other client-side code here, such as client side libraries, add client only providers, etc.

app/entry.client.tsx
import { startTransition, StrictMode } from "react";
import { hydrateRoot } from "react-dom/client";
import { HydratedRouter } from "react-router/dom";

startTransition(() => {
  hydrateRoot(
    document,
    <StrictMode>
      <HydratedRouter />
    </StrictMode>
  );
});

Generating entry.client.tsx

By default, React Router will handle hydrating your app on the client for you. You can reveal the default entry client file with the following:

npx react-router reveal
Traducción © 2026 fanyi.dev · Original © 2026 React Training LLC, Remix Software Inc., Shopify Inc. (MIT)