内のすべての秒の間隔でHTMLに現在のタイミング値をレンダリングします。私は以下のコードを貼り付けた。コードを実行するとエラーが表示されます。あなたのrender()
メソッド内setInterval()
を置くは私がreactjsを使用して、すべての秒間隔でHTMLに現在のタイミング値をレンダリングしたいreactjs
import react from "react";
**Defined class**
export default class IndependentTimer extends react.Component {
constructor() {
super();
this.state = {
value: ""
};
this.customFunction = this.customFunction.bind(this);
}
**This function is responsible for generating current time.**
customFunction() {
console.log("customFunDis display!");
return (<h1> Time is : {new Date().toLocaleTimeString()} </h1>);
}
**render function**
render() {
return (
<div>
{**What to do here?**}
</div>
);
}
}
** Error I Got is : **
I got that error at every interval of time.
VM413:1 Uncaught SyntaxError: Unexpected identifier
setInterval (async)
render @ index.js:31245
どのようなエラーが表示されますか? –
あなたは十分な答えを得たと思います! :) – Dane
'はい。私は答えを得た。ありがとうございます。 –