this is the render function
export function RenderSection({initSection,response,setResponse}) {
log("rendersection");
if (initSection.body) {
log('initSection.body.type : ',initSection.body.type);
}
const [_visible,setVisible] = React.useState(true);
const remove = () => {
log('removing section');
//setVisible(false);
let newSections:any = [];
for (let section of response.sections) {
if (section.key != initSection.key) {
newSections.push(section);
}
}
setResponse({
sections: newSections,
prop:response.prop,
header:response.header,
init:true,
loaded:true
});
}
this is the part where function is called
const scrollingContent = React.useMemo(()=>{
return <View>
{response.sections.map(section=>{
return <fn.RenderSection initSection={section} response={response} setResponse={setResponse} />;
} ) }
</View>;
}
,[response]);
this is sections:
[{"body": {"children": [Array], "prop": [Object], "type": "view"}}]
and this json from the website
{"status":"ok","header":[],"prop":{"bgimg":null,"bgcolor":"#5f97cf"},"sections":[{"body":{"type":"view","children":[{"type":"text","child":"My Jcow Network","prop":{"style":[["font-size","40px"],["color","white"],["text-shadow","1px 1px 4px #666666"]]},"key":"64b152ee0232d"},{"type":"text","child":"This is a Social Network","prop":{"style":[["font-size","30px"],["color","white"],["text-shadow","1px 1px 4px #666666"]]},"key":"64b152ee02332"},{"type":"button","prop":{"title":"Create account","type":"link","color_type":"bold","uri":"member\/signup"},"key":"64b152ee02402"},{"type":"line_break","0":"key\"=> uniqid()"},{"type":"button","prop":{"title":"Login","type":"link","uri":"member\/login"},"key":"64b152ee024c2"}],"prop":{"style":[["height","610px"],["margin","20px"],["justify-content","center"],["flex-direction","column"]],"type":"column"}},"title":null,"key":"995cbe34042e7590419d13b97e312608","bgcolor":"transparent","platforms":["web","app"]}]}
where this key is missing? I'm new to react-native