I am trying to create an app whereby a user can highlight a particular word when they click (or double click) on that particular word. That is to say, that the user can click on any word in any paragraph in the article in question and highlight it either by changing it's background color or by changing it's font color.
I am having trouble, though, figure out how to do this. I don't want the entire paragraph highlighted and I don't want to have to wrap each word in a unique component or html tag. What I basically want is a wrapping component for the entire article that will note only the particular word being clicked and then allow me to decide what css properties on that word I want to change (such as background color or text color).
But I can't figure out how to do this. Is there a library that already does this. If not, how can I wrap the article as a whole but get access to the singular word that is being clicked?
For what it is worth, I am creating the app using React.