How to make one dropdown menu dependent on another
I have a dropdown menu showing states and counties. I want the county one to be dependent on the state one. I am using react, javascript, prisma to access the database. I made it work separated, so I can get the states to show and the counties, but I don't know how to make them dependent. What I think I need is a way to change my function that bring the county data. I can group by the state that was selected. So what I need is after getting the state that was selected to send that to my "byCounty" function. Is that possible? menu.js export default function DropDownMenu(props){ if(!props.states) return return( <table> <body> <select onChange={(e) => { console.log(e.target.value) }}> {props.states.map(states=> <option>{states.state}</option> )} </select> <select > {props.byCounty.map(byCounty=...