extending React.Component vs Component

后端 未结 2 1491
后悔当初
后悔当初 2021-02-05 01:51

I just got in a project on React Native, where I constantly see classes extending both React.Component and Component itself.

Examples:

2条回答
  •  感动是毒
    2021-02-05 02:44

    import {Component} from 'react';
    

    This is called named module import.

    The module to import from. This is often a relative or absolute path name to the .js file containing the module, excluding the .js extension. Certain bundlers may permit or require the use of the extension; check your environment. Only single quotes and double quotes Strings are allowed.

提交回复
热议问题