How to correctly wrote {onChange=} to get option value data

  Kiến thức lập trình

How to correctly wrote this code in typescript?


const newValue: string = selectValue;

export default async function main() {
  const callUsers = await prisma.user.findMany({
    where: {
      id: newValue,
    }
  })
  const email = callUsers.map((user: any) => user.email)
  return (
    <div>
      <select value={selectValue} onChange={handleChange}>
        <option value='1'>1</option>
        <option value='2'>2</option>
      </select>
      <p>{email}</p>
    </div>
  )
}

I expect to get value from options

New contributor

Dwipa Arantha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT