diff --git a/src/content/learn/responding-to-events.md b/src/content/learn/responding-to-events.md index 4450c461..103d7523 100644 --- a/src/content/learn/responding-to-events.md +++ b/src/content/learn/responding-to-events.md @@ -1,24 +1,24 @@ --- -title: Responding to Events +title: ການ Respond ຕໍ່ Events --- -React lets you add *event handlers* to your JSX. Event handlers are your own functions that will be triggered in response to interactions like clicking, hovering, focusing form inputs, and so on. +React ໃຫ້ທ່ານເພີ່ມ *event handlers* ໃນ JSX ຂອງທ່ານ. Event handler ແມ່ນຟັງຊັ່ນຂອງທ່ານເອງທີ່ຈະຖືກ trigger ໃຫ້ຕອບສະໜອງຕໍ່ interaction ເຊັ່ນ ການຄິກ, ການ hover, ການ focus form input ແລະ ອື່ນໆ. -* Different ways to write an event handler -* How to pass event handling logic from a parent component -* How events propagate and how to stop them +* ວິທີຕ່າງໆໃນການຂຽນ event handler +* ວິທີການສົ່ງຜ່ານ logic ຂອງ event handler ຈາກ parent component +* Event ກະຈາຍແນວໃດ ແລະ ຈະຢຸດແນວໃດ -## Adding event handlers {/*adding-event-handlers*/} +## ການເພີ່ມ event handlers {/*adding-event-handlers*/} -To add an event handler, you will first define a function and then [pass it as a prop](/learn/passing-props-to-a-component) to the appropriate JSX tag. For example, here is a button that doesn't do anything yet: +ໃນການເພີ່ມ event handler, ທຳອິດທ່ານຈະຕ້ອງກຳນົດຟັງຊັ່ນ ຈາກນັ້ນ [ສົ່ງຜ່ານເປັນ prop](/learn/passing-props-to-a-component) ໄປຫາແທັກ JSX ທີ່ເໝາະສົມ. ຕົວຢ່າງ, ນີ້ແມ່ນປຸ່ມທີ່ຍັງບໍ່ທັນໄດ້ເຮັດຫຍັງ: @@ -34,11 +34,11 @@ export default function Button() { -You can make it show a message when a user clicks by following these three steps: +ທ່ານສາມາດກຳນົດໃຫ້ສະແດງຂໍ້ຄວາມເມື່ອຜູ້ໃຊ້ຄິກໂດຍປະຕິບັດຕາມສາມຂັ້ນຕອນ: -1. Declare a function called `handleClick` *inside* your `Button` component. -2. Implement the logic inside that function (use `alert` to show the message). -3. Add `onClick={handleClick}` to the `