I want to display data using section List in react native. I am extracting data using reduce() but I am not able to understand why I am getting undefined behaviour saying please provide html or uri as prop for react native render html.
I want to display sectionList items as HTML content and title of SectionList is the title from specificationsData.
const specificationsData = specifications.reduce( (acc, curValue) => {
if (curValue.title !== undefined && curValue.description !== undefined){
let newObj = {};
newObj['data'] = curValue.description;
newObj['title'] = curValue.title;
console.log(curValue.title)
acc.push(newObj);
return acc;
}
}, []);
console.log(specificationsData)
Result of above log:
Now I pass above data into SectionList:
import HTMLView from 'react-native-render-html';
<SectionList
renderItem={({item, index, section}) => <HTMLView key={index} value={item}/>}
renderSectionHeader={({section: {title}}) => (
<Text style={{fontWeight: 'bold', color: 'red'}}>{title}</Text>
)}
sections={specificationsData}
keyExtractor={(item, index) => item + index}
/>
How can I pass display data and title of sectionList by passing specificationsData ?
See screenshot of above code:


({section: {title}}).<Text style={{fontWeight: 'bold', color: 'red'}}>{title}</Text>is perfect I think there is some issue withHTMLView