Skip to content

Tag: reactjs

React set a state to the result of an API call

I’m making a call to a getTime function which returns the datetime, but for some reason the state I specify is not being updated, am I misunderstanding how this works? Do I need to await the result? Answer Yes, exactly, it’s a fetch, so you gotta wait for the result and set the state only then, so…

css modules in react

I am having some trouble with css modules in react I dont know how to use react modules in a dynamic way I want to be able to display the classes showing the value that corresponds to the element in state . is this even possible or should I approach the problem differently I want to be to do some