简体   繁体   中英

What kind of checks and warnings does React.StrictMode activate?

From React documentation on React.StrictMode and React.Fragment:
Both Fragment, StrictMode does not render any visible UI. It activates additional checks and warnings for its descendants.

Question: What kind of checks and warnings does React.StrictMode activate on this code?

import React from 'react'

export default function About() {
    return (
        <React.StrictMode>
            <h1>About page</h1>
            <p>This is a text deescribing the About page</hp>
        </React.StrictMode>
    )
}

The article you linked states exactly what it helps with:

StrictMode currently helps with:

  • Identifying components with unsafe lifecycles
  • Warning about legacy string ref API usage
  • Warning about deprecated findDOMNode usage
  • Detecting unexpected side effects
  • Detecting legacy context API

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM