I am getting an below error. I can see that I have to return array instead of object. But I am really not sure how to fix it. Thanks in advance
Object
<Note note={
<p>{(new Date(updated_at)).toString()}</p>
} />
In this case, Note is my child component and I had passed date as above and it worked for me.
Output Pass date to React Child
JSON.stringify()
because this.state.timeElapsed
is the object. object not able to print in normal standered. Thus we need to render that object in JSON.stringify()
. It converted into JSON form.
Try this, It's work for me
{JSON.stringify(this.state.timeElapsed)}
timeElapsed is an object, React doesn't know how to render this:
<View style={[styles.timerContainer, this.borderColor('#ff6666')]}>
{this.state.timeElapsed}
</View>
Try changing this.state.timeElapsed
for a string like for example:
<View style={[styles.timerContainer, this.borderColor('#ff6666')]}>
{this.state.timeElapsed.toString()}
</View>