'Scroll/jump to old message from history in chatapp using reactjs

I'm building chat app using Nodejs on the server-side and Reactjs for the client app

When the user search in messages by text using the search box which is beside the chat box and results show up, the user should click on the message from the result and then scroll up to this message in the chat box

the problem is that this message may not be fetched from the server yet so it is not in the current state messages, and could be between older and newer messages in this chat messages

I need some recommendation for the way i should implement this functionality without losing the current fetched state messages,

Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source