Fix text component
@@ -8,11 +8,10 @@ export interface Props {
}
function Text({text, title}: Props) {
- let processedText = text.length > 0 ?
- (text.split('\n').map((line, i) => <p key={i}>{line}</p>)) :
- (<p>No content!</p>);
+ let processedText = (text && text.length > 0) ?
+ text.split('\n').map((line, i) => <p key={i}>{line}</p>) :
+ <p>No content!</p>;
function getText() {
- if (text) {
return (
<div className="text">
<div className="row">
@@ -32,8 +31,6 @@ function Text({text, title}: Props) {
</div>
);
}
- return (null);
- }
return (getText());
}
