How would you add color to individual words in a React input box component?

208 Views Asked by At

I'm currently trying to implement a sort of "highlighting" functionality to a React webpage input box.

The idea is that when the user is typing, each word is sent off to be compared to a list, and then I'd like the input text to change color for each word based on the kind of word it is (object, relation, etc.).

So far I think I've got a grasp on how to change the whole input box text color, but I can't for the life of me figure out how to change the color of each of the words individually.

Does anybody have an idea for how to approach this?

0

There are 0 best solutions below