Answer the question
In order to leave comments, you need to log in
How to call a method?
Is there any way to call the function at the place where I tried to call it, so that the text that the method will return is displayed there?
class RangeTimeEvent extends React.Component {
constructor(props) {
super(props);
this.state = {
card: []
}
this.takeDate = this.takeDate.bind(this);
}
takeDate() {
this.state.card.map(index => {
return (
<div>{index.date}</div>
);
})
}
render() {
return (
<div className="in-time">
<div className="time block active tab-1"><p>{this.takeDate()}</p></div>
</div>
)
}
}
Answer the question
In order to leave comments, you need to log in
takeDate() {
return this.state.card.map(index => {
return (
<div>{index.date}</div>
);
})
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question