reactjs - 调用一个反应组件 - 作为一个函数
问题描述
我正在使用 quokka 并想从内部运行一个反应组件
I have a simple button
import React, { MouseEvent } from 'react';
type Props = {
text: string
};
export const Button = ({ text }: Props) => {
return <button> {text} </button>;
};
Button('hello') /*?*/ what goes in here?
我将其称为普通函数,但我试图找出如何传递道具?
上述元素的值
{ '$$typeof': Symbol(react.element),
type: 'button',
key: null,
ref: null,
props: { children: [ ' ', undefined, ' ' ] },
_owner: null,
_store: {} }
解决方案
推荐阅读
- java - 如何正确使用 Image.SCALE_DEFAULT?
- python - Python 类/对象 __str__ 和其他问题
- dart - Flutter 如何更新/添加值到映射中的键
- java - 使用对象数组对 Java 进行堆排序
- javascript - 使用 Javascript Entity Framework C# MVC Json 添加记录时出错
- javascript - 在 Hover 上仅从几个具有相同类的 Div 中更改一个
- java - 如何在java重载中获取结果值
- python - 将 int 的副本写入字典
- python - 关于将 json 作为函数输入传递的建议
- apache-spark - 联合两个具有嵌套不同模式的数据框