You summed it up perfectly, react-query aims to literally solve this exact problem.
It does it quite well I might add.
React, Mobx etc are all reactive frameworks exactly for this reason. Given a set of data render x, update the render every time the data changes.