我正在尝试在React 16.3.1中使用新的Context组件.我正在运行一个非常简单的例子:
const TestContext = React.createContext();
export default class Test extends Component {
render () {
return (
<TestContext.Provider value="abc">
<TestContext.Consumer>
{value => (
<div>{value}</div>
)}
</TestContext.Consumer>
</TestContext.Provider>
);
}
}
Run Code Online (Sandbox Code Playgroud)
但是代码不会呈现,而是产生此错误:
Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
似乎Provider和Consumer组件都不是有效组件,并且不能由React呈现.
我在这里错过了什么吗?
似乎大多数流行的电子邮件客户端都不包含X-Mailer标头。有没有什么好的方法来确定电子邮件是否由流行的客户端(例如 Gmail、Outlook 或 Apple Mail)发送?
我希望在Ruby on Rails应用程序中解析远程客户端的主机名.
我知道这Request.remote_ip会给我客户端的IP地址,但是如何将其转换为主机名呢?