使用componentDidMount()作为一个异步函数的良好做法作出反应本地还是应该避免呢?
我需要从AsyncStorage组件安装时获取一些信息,但我知道实现这一点的唯一方法是使componentDidMount()函数异步.
async componentDidMount() {
let auth = await this.getAuth();
if (auth)
this.checkAuth(auth);
}
Run Code Online (Sandbox Code Playgroud)
这有什么问题,还有其他解决方案吗?
这是我第一次使用axios而且遇到了错误.
axios.get(
`http://someurl.com/page1?param1=1¶m2=${param2_id}`
)
.then(function(response) {
alert();
})
.catch(function(error) {
console.log(error);
});
Run Code Online (Sandbox Code Playgroud)
使用正确的URL和参数,当我检查网络请求时,我确实从我的服务器得到了正确的答案,但是当我打开控制台时,我发现它没有调用回调,而是发现了错误.
错误:网络错误堆栈跟踪:createError @ http:// localhost:3000/static/js/bundle.js:2188:15 handleError @ http:// localhost:3000/static/js/bundle.js:1717:14
我已经搜索了所有标题相似的问题,但还没有解决方案。
我有一个在apache2上运行的网站。我需要通过表单提交敏感信息,并且需要使用POST方法。代替POST,它发送GET请求。
HTML:
<form action="/add_user.php" method='POST'>
Enter Username: <input type="email" name="email" required="required" /> <br/>
Enter password: <input type="password" name="password" required="required" /> <br/>
<input type="submit" value="submit"/>
</form>
Run Code Online (Sandbox Code Playgroud)
PHP:
<?php
$email=$_POST['email'];
$password=$_POST['password'];
//do stuff
?>
Run Code Online (Sandbox Code Playgroud)
我已经在Firefox中打开了网络监视器,并且该方法被确认为GET。我什至试图使其成为PUT而不是POST,但它仍然发送GET。此外,$email和$password得到的值,如果我改变他们$_GET,而不是$_POST。
任何帮助,将不胜感激。
我刚刚更新create-react-app,4.0.0遇到了很多问题。第一个是
TypeError: Cannot add property noFallthroughCasesInSwitch, object is not extensible
我通过添加"noFallthroughCasesInSwitch": true,到我的tsconfig.json
现在我可以启动该应用程序,但一切都出了问题。我有数百万个显然未被起诉的变量,尽管它们并非如此。
我已经更新typescript了,4.0.5但是问题依然存在。
另外,当我敲击时,我的机器变得非常响亮yarn start
我正在构建一个游戏,当我使用以下代码更改2d-map中的值时
char example[100];
strcpy(example, " ");
strcat(example, player1->unitName[j]);
strcat(example, " ");
map->map[x][y] = example;
Run Code Online (Sandbox Code Playgroud)
我在地图变化中用示例表示的全部值.
我想我正在把指针放到这个例子中.
有什么方法我可以只放置示例的值而不是地址或指针?
reactjs ×3
apache2 ×1
asynchronous ×1
axios ×1
c ×1
forms ×1
html ×1
javascript ×1
php ×1
post ×1
react-native ×1
strcpy ×1
struct ×1
typescript ×1