I am getting 'Restricted async operation 'setTimeOut' in LWC' error in VS Code when I use setTimeOut
in connectedCallback
.
.html file
<template>
<div class="wrapper">
<header class="header" if:true={ready} >Available Bikes for {name}</header>
</div>
</template>
.js file
import { LightningElement, track, wire } from 'lwc';
export default class Selector extends LightningElement {
@track
ready = false;
connectedCallback() {
setTimeout(() => {
this.ready = true;
}, 3000);
}
What is the alternative to perform any action after certain time in LWC?
connectedCallback()
and came to this error and could not find the exact reason behind this. I think I was trying display some content once the page loads which can be achieved withrenederedCallback()
– devforce May 30 '19 at 7:51