Button on sidebar isn’t unclickable. On my main page, button element works clearly but on sidebar, it is not working.
import { useContext, TouchableOpacity } from "react";
import { DataContext } from "../App";
import "./SideBar.css";
const SideBar = () => {
const [showModal, setShowModal] = useContext(DataContext);
return (
<div
className={showModal ? "modal-dialog show" : "modal-dialog"}
role="document"
>
<div className="sideBar">
<div className="sideBarHeader">
<h5>Add City</h5>
<button >
Trial
</button>
</div>
</div>
</div>
);
};
export default SideBar;
3
Answers
you havent given onclick function in buttton
You must provide a click event to your button
Please add a click handler on button onCLick here is your updated code: