To highlight text using React, we can use the react-highlighter
module.
To install it, we run
npm i react-highlighter
Then we write
const Highlight = require("react-highlighter");
<Highlight search="brown">
The quick brown fox jumps over the lazy dog
</Highlight>
to use the Highlight
component to highlight 'brown'
in 'The quick brown fox jumps over the lazy dog'
.