JSFiddle - React, Tailwind, and code Playground

JavaScript

var theText='Ohhhh #ohhh #oh #ohh #ohhhh ohhh oh';
var words = theText.split(' ');
var newWords = words.map(function(part){
		if(part.indexOf('#')==0)
			return "<a href='/'>"+part+"</a>\n";
		else
			return part+" ";
});

var newText = newWords.join('');
console.log(newText);