我看到了一些像这样的示例代码:
import React from 'react' import MyComp from 'my-comp' const MySubComp = MyComp.MySubComp class Page extends React.Component { render() { return ( <MyComp> <MySubComp/> </MyComp> ) } }
如何实现MyComp.MySubComp的语法?
它有术语吗?
在您的示例中,MySubComp是MyComp的静态类成员,您可以轻松地实现它:
原文链接:https://www.f2er.com/react/300675.htmlexport default class MyComp extends Component { // ... } MyComp.MySubComp = class MySubComp extends Component { // ... }