Expose functions to help add a price update into the order book. Something like (book: Book, update: BookUpdate) => Book, but possibly a class to maintain the book prices in a tree for efficient insert and deletes. See bintrees, and the RBTree.
This could also be written as a hook.
Here's a rough example of what this might look like:
import { OrderBook, mergeUpdates } from '@lab49/react-order-book';
const MyComponent = ({ bookData: Book, bookUpdate: BookUpdate }) => {
const book = mergeUpdates(bookData, bookUpdate);
return <OrderBook book={book} />;
}