I'm trying to get the release year from the release_date (as props) passed to a React function component, but I'm getting a string undefined error.
const Banner = ({ backdrop_path, poster_path ,title,release_date}) => { return (); }; export default Banner; {title} ({release_date.split("-")[0]})
When I use release_date directly, it renders fine, no problem. But when I apply any method on string it returns undefined. (release_date is a string, such as "2023-07-18")
I recommend adding a condition to ensure I don't have empty brackets (e.g. if your data get returns empty).