Last active
June 3, 2019 15:37
-
-
Save athulmurali/19c106afa7cd449584abe19cb2f49e98 to your computer and use it in GitHub Desktop.
Selection fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Note: some may have selectedWidget, some may not , ignore it if it is not yours. | |
// while selecting a module, set topic and selectedWidget to null so that you don't retain the existing selection | |
// while selecting a lesson, set widget and selectedWidget to null | |
// This is just a sample code | |
this.state={ | |
// ... | |
selectedModule: course.modules[0], | |
selectedLesson: course.modules[0].lessons[0], | |
selectedTopic: course.modules[0].lessons[0].topics[0] | |
// ... | |
} | |
// To handle the issue, | |
// replace that code and initialize with | |
{ | |
selectedModule: null | |
selectedLesson: null | |
selectedTopic: null | |
} | |
render(){ | |
return <div> | |
{this.state.selectedModule && <LessonList>} | |
{this.state.selectedLesson && <TopicList>} | |
{this.state.selectedTopic && <WidgetList>} | |
<div> | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment