In my current project, I am developing a feature that allows users to toggle between graph and list views. The view's container is assigned the class name "two".
toggleGraphView() {
const two = document.getElementsByClassName('two')[0];
two.innerHTML = '<span>Graph View!</span>'
}
toggleListView() {
const two = document.getElementsByClassName('two')[0];
two.innerHTML = "<ShotLog shotLog={this.state.shotLog}/>"
}
When switching to the graph view text ('Graph View!'), everything works as expected. However, when trying to switch back to the list view, I encounter an issue. After executing toggleListView, the content of the 'two' container in Chrome tools shows
<shotlog shotlog="{this.state.shotLog}/"></shotlog>
. It should actually display <ShotLog shotLog={this.state.shotLog}/>
to correctly pass the props.
I am unsure where the additional quotations are originating from. Do you have any insights?