@KevinB Would be my guess too, but the fact that they added a version of setState that includes a callback parameter that gets called after the state is actually set made me a tad worried.
@VLAZ if you are setting the same flag on the state the order does matter. In the correct order you will display the loader and then make it invisible. It the two assignments are performed in the wrong order then you hide an already hidden loader.. and then you make it visible forever. Forget the fact that the logic should "take enough time to let the previous .setState complete"
In your render method you can have one loader implemented like
<Loader visible={this.state.visibility}>
In your searchData method, you can set the visibility of this loader true in the first line and false in the last line like below
searchData = () => {
// Start the loader
this.setState({
...
So. Simple question: suppose you have an async api call and want to show a loading message during the call. Most will tell you to "just set a state variable before and after the call, then do some conditional rendering based on that"
Hello. Sorry to bother you folks. Anyone here familiar with React wanting to spare some time for a question? I saw some answers on the main site that seem quite wrong...
@VLAZ yep, that is an option. Right now I am using a development vm that had some preconfigured settings so I wanted to alter as little as I can but I guess that if anything fails... VS Code it is.
@iLuvLogix for that specific question the problem similar but not the same. In that case, the original poster is trying to use that syntax in javascript. So that probably is related to the target ecmascript/javascript build version. Anyway, thanks for the suggestion, will continue to look if something comes up
Like I said, I am using the 3.8 typescript package yet the editor underlines any instance of the optional chaining operator as wrong syntax. The optional chain was introduced since version 3.7, so it should be supported in 3.8.
@iLuvLogix yep, that is what the documentation on this page says. My understanding is that if you specify an npm package, then intellisense should use that version... but apparently it is not working that way.
My understanding is that VS2022 does no longer use external SDK installation, and should just enforce whatever is provided, either by a nget package or a npm one (my case)
Anyone knows how VS 2022 picks the typescript version it uses for providing intellisense? I have Typescript 3.8 specified in the project pakage.config file, yet the editor does not recognize the optional chaining .? syntax added in ts 3.7. Obviously, the thing works at runtime.