Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
449 views
in Technique[技术] by (71.8m points)

React 父组件调用子组件方法 有没有类似 Angular 这种方式?

Angular 里 父组件调用子组件方法很简单,打个标签就可以直接用

<ng-container>

 <a (click)="child.sayHi()">click</a>

 <app-children #child>

 <p>children?text</p>

 </app-children>

</ng-container>

但是 react 就需要用 createRef(), 所以我想知道,有没有什么别的方式??


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...