Answer the question
In order to leave comments, you need to log in
JavaScript context binding?
Good afternoon. Please tell me how can I bind the context to taskListStorage.find ?
import React from 'react';
import taskListStorage from '../data.js';
export default class TaskList extends React.Component{
constructor(props) {
super(props);
this.state = {
taskList: []
}
}
getTaskListTemplate() {
taskListStorage.find({}, (err, task) => {
this.setState({taskList: this.state.taskList.push(task)});
});
}
render() {
this.getTaskListTemplate();
return (
<div>
<h1>Task List</h1>
<ul>
</ul>
</div>
);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question