Question: I am new to React.js. I am not sure how to add `delay` to render in React.js. What is the best way to add delay.

I am adding the following code in render but its not working.

```
setTimeout(function() {

}, 1000);

```

Answer: 
**Pure typescript Solution**

You would be able to create delay function with `async`:

```
function timeout(delay: number) {
    return new Promise( res => setTimeout(res, delay) );
}

```

And then call the function:

```
await timeout(1000); //for 1 sec delay

```
If you like Ronit's solution but want pure javascript

```
function timeout(delay) {
    return new Promise( res => setTimeout(res, delay) );
}
await timeout(1000);

```