I'm very new to react, so be please be gentle. I have a relatively flat JS file that contains some questions. It looks like this:
export default [
{
category: 'General Questions',
title: 'Question 1?',
content:'Answer 1',
},
{
category: 'Pricing',
title: 'Question 2?',
content:'Answer 2',
},
I have multiple categories throughout the file. What I'd like to do is create a list of all the unique categories. So the user would only see
- General Questions
- Pricing
- Etc.
I'm able to get all of the content using a filter
function here:
getFaqContent() {
return filter(item => {
return item.featured;
}, Faqs);
}
How can I just get the unique categories?