Skip to content

TAsk-4 : Moved internal state to store for TodoListContainer component. #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/pages/TaskListPage/TodoListContainer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { setLoader } from "../../../actions/ui";
class TodoListContainer extends Component {
constructor(props) {
super(props);
this.state = {
list: [],
filterApplied: false,
hideTimer: false
};
// this.state = {
// list: [],
// filterApplied: false,
// hideTimer: false
// };
this.state = props.state;
this.toggleTimer = this.toggleTimer.bind(this);
this.toggleListItem = this.toggleListItem.bind(this);
this.performAddTask = this.performAddTask.bind(this);
Expand Down Expand Up @@ -64,7 +65,7 @@ class TodoListContainer extends Component {

render() {
const { filterApplied } = this.state;
const { list, loading } = this.props;
const { list, loading } = this.props.state;
return (
<TodoList
list={list}
Expand All @@ -81,7 +82,8 @@ class TodoListContainer extends Component {
const mapStateToProps = state => {
return {
loading: state.ui.loading,
list: state.tasks.data
// list: state.tasks.data
state: state.tasks.data
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/reducers/initialState.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ const initialState = {
notifcations: []
},
tasks:{
data: []
// data: [],
data: {
list: [],
filterApplied: false,
hideTimer: false
}
},
dashboard: {
data: []
Expand Down