0

For a school project I need to give bikers directions based on the value I get from a sensor. The sensor is able to send PUT requests to a db, with a value that is true or false. I'm using Fetch Suspense to retrieve that object from the db. And I use the value of that object in an if else statement.

The fetch methode works just fine, so does the PUT requests.

The problem however is that I can only see the change of true->false or visa versa when I refresh the page.

Is there any way to re-render the application with Fetch Suspense?

Any help would be greatly appreciated !

https://codesandbox.io/embed/mystifying-wing-hsgf1?fontsize=14

1 Answers1

1

Don't instantiate a component inside another component. I would suggest to extract the App bit as a separate component and pass the value from the API as a prop to a component that renders the directions.

Mark Shulhin
  • 119
  • 5