So I am setting my state in my constructor with:
constructor(props: IProps) {
super(props);
const nav = NavService.getNav();
const user = AuthService.getProfile();
this.state = {
activeNav: 0,
nav: nav ? nav : [],
showDropdown: false,
showNavDropdown: false,
user: user ? user : [],
};
}
However, I am noticing some async issues so I want to make getNav() and getProfile() async and await them. Obviously I can't do this in the constructor because constructors cannot be async and therefore I cannot use await. Now I know I can just throw this into an async componentDidMount() but this causes a double render(). How can I optimize this?
nullor a placeholder)?