The render() method

Next, we implement the render method. What we do is take the properties, which should never be directly mutated and probably should not have any existing value changed, and get the two strings from them. We will, token by token, display everything in the first string, and repeat the second as many times as the component is displayed. We will also create a tokenize function for rendered HTML converted from Showdown—this breaks its argument to each next tag or the next character—and, in a moment, see why we are creating a verbose anonymous function instead of a regular expression (in a nutshell, writing readable code in lieu of a regular expression appears verbose compared to the terseness available in writing write-only code). ...

Get React: Building Modern Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.