Check out example codes for "Wrap the last word of a paragraph in span tags using jQuery". It will help you in understanding the concepts better.

Code Example 1

<script src=""></script>
<p>Phasellus sit amet auctor velit, ac egestas augue.</p>

Code Example 2

		// separate the text by spaces
		var text= $(this).text().split(' ');
		// drop the last word and store it in a variable
		var last = text.pop();
		// join the text back and if it has more than 1 word add the span tag
		// to the last word
		return text.join(" ") + (text.length > 0 ? ' <span class="last">'+last+'</span>' : last);   


Learn ReactJs, React Native from