> For the complete documentation index, see [llms.txt](https://xiaoyang-liu.gitbook.io/programming-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xiaoyang-liu.gitbook.io/programming-notes/web-development/react-internals/strict-mode.md).

# Strict Mode

* `StrictMode` is a tool for highlighting potential problems in an application.
* `StrictMode` does not render any visible UI.
* `StrictMode` only checks its descendants.

```jsx
const ExampleApplication = () => (
  <div>
    <Header />
    <React.StrictMode>
      <ComponentOne />
      <ComponentTwo />
    </React.StrictMode>
    <Footer />
  </div>
);
```

## Identifying unsafe lifecycles

Certain legacy lifecycle methods are unsafe for use in async React applications. When strict mode is enabled, React logs a warning message with information about the components using the unsafe lifecycles.

## Detecting legacy context API

The legacy context API is error-prone, and will be removed in a future major version.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xiaoyang-liu.gitbook.io/programming-notes/web-development/react-internals/strict-mode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
