import React from "react"; import Character from "./Character"; interface Props { children: string; } class CharacterString extends React.Component { shouldComponentUpdate(nextProps: Props) { return nextProps.children !== this.props.children; } render() { const text = `${this.props.children}` || ""; const chars = text.split(""); return chars.map((character, index) => ( {character} )); } } export default CharacterString;