I am working with an array of objects named movies (const movies = movie[]). Each movie object includes properties like name, description, date and duration.
movie: {
name: string;
description: string;
date: Date;
duration: number
}
My goal is to utilize a React Native SectionList component to create sections based on the movie's date:
**20 june 2020:**
Movie name | description | duration
Movie name | description | duration
**18 april 2020:**
Movie name | description | duration
Movie name | description | duration
...
How can I generate these sections and group my movies by date? I attempted using lodash with const groupedMovies = groupBy(movies, movie => movie.date), but it resulted in a collection and not an array.
Reference: https://reactnative.dev/docs/sectionlist