使用React.js和React Router
import React, { Component } from 'react';
const PrivateRoute = ({ component: Component, ...rest }) => (
<Route {...rest} render={} />
)
Run Code Online (Sandbox Code Playgroud)
*{ component: Component, ...rest }*
..rest是使用扩展语法但是做了*component: Component*什么
所以我知道你可以在颜色字段中添加颜色选项,例如
[{'color': "#000000"}]
Run Code Online (Sandbox Code Playgroud)
但我想知道是否有办法让用户可以选择颜色
<input type="color">
Run Code Online (Sandbox Code Playgroud) 我的 nodejs 应用程序连接到外部 url 并使用响应。该应用程序大部分时间都运行良好,但我偶尔会收到 EAI_AGAIN。
error:{code:EAI_AGAIN, errno:EAI_AGAIN,syscall:getaddrinfo,hostname:**.com,host:***.com,port:443}
Run Code Online (Sandbox Code Playgroud)
我经历了一些与 EAI_AGAIN 相关的问题。没有解决我的目的。看到当 DNS 名称解析失败时会发生此错误。
我的担忧是
1)当我检查日志时。在失败的请求之前有很多成功的请求,在失败的请求之后也有很多成功的请求。为什么只有一个请求失败?
2) 真正的原因可能是什么?我想知道所有的可能性。
3) 原因可能是我们正在连接的外部服务的问题吗?
4)如果有人可以帮助重新创建问题,那就太好了。
注意:我们使用的是 docker 容器。如果这有什么关系。
could you please tell me how to show error message in react js when http request send ?
I make a service in the nodejs where I am sending 400 status with error message . I want to show this error message on frontend.
app.get('/a',(req,res)=>{
res.status(400).send({message:" some reason error message"})
})
Run Code Online (Sandbox Code Playgroud)
Now I want to show this error message on frontend .on catch I will not get this message.
try {
const r = await axios.get('http://localhost:3002/a');
} …Run Code Online (Sandbox Code Playgroud)