Unexpected mistake with the State #733
Replies: 1 comment
-
I've solved the problem! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I want to show/hide a Map component by clicking button (the text on the button should change).
The State created for this purpose changes its value when the button is clicked (the text on the button changes), but the Map component does not react to the changed value of the State.
It`S my code:
const [detailsPage, setDetailsPage] = useState(false);
function handleOnDetailsPage() {setDetailsPage(!detailsPage);}
...
<button type="button" onClick={handleOnDetailsPage}>
{detailsPage ? "Map verstecken" : "Map anzeigen"}</button>
...
{detailsPage && <Map dataOne={data} detailsPage={detailsPage} />}
My PR
The required code is LocationDetails and Map components.
Beta Was this translation helpful? Give feedback.
All reactions