首页 > 解决方案 > React - 如何将字体大小添加到 React.createElement 中?

问题描述

我是块新手并学习 React - 我在下面有这部分功能:

AlertNotifications.prototype.render = function () {
    return (React.createElement("div", null, this.props.alerts.map(function (alert) { return React.createElement(MessageBar, { messageBarType: alert.type === AlertType.Urgent ? MessageBarType.severeWarning : MessageBarType.warning, isMultiline: false },
        alert.message,
        alert.moreInformationUrl ? React.createElement("a", { href: alert.moreInformationUrl }, strings.MoreInformation) : ''); })));
};
return AlertNotifications;

我需要更改返回的 DIV 的字体大小 - 请让我知道我需要更改什么 - 或者添加到上面以将字体大小更改为 Arial 16px?

提前谢谢了

G

标签: reactjsfontscreateelement

解决方案


您可以添加一个类并为其设置样式。

React.createElement('div', {class-here}, .......)

推荐阅读