I have a functional react component with text that is displayed from a mapped array. How can I limit the character count of {item.description}
to 250 characters?
import React from "react";
const Component = props => {
const classes = props.classes;
return (
<div className={classes.container}>
<ul className={classes.items}>
{props.children.map((item, i) => (
<li key={i} className={classes.item}>
<p className={classes.category}>
{item.genre} {item.date}
</p>
<p className={classes.header}>{item.header}</p>
<p className={classes.details}>{item.description}</p>
</li>
))}
</ul>
</div>
);
};