Sample Calculator In LWC
In this LWC scenario, We are going to work on building a sample calculator in LWC. This scenario include topics like event handling, lightning input, lightning button etc.
This problem statement has been designed for developer who has intermediate skills in Lightning Web Component.
Create a Lightning Web Component which can be placed in a Lightning App Page where users can do quick calculations like Addition, Subtraction, Multiplication & Division.
- You have to create two component. The first component will have two input field of type number
- Second Component will call the first component
- Second component will have 4 buttons – Add, Subtract, Multiply & Divide
- If user clicks on Add button, It should add two values entered by user in two input fields
- If user clicks on Subtract button, It should subtract two values entered by user in two input fields
- If user clicks on Multiply button, It should add multiply values entered by user in two input fields
- If user clicks on Divide button, It should divide two values entered by user in two input fields
- The result should be displayed in read only input field
Do you need help?
Are you stuck while working on this requirement? Do you want to get review of your solution? Now, you can book dedicated 1:1 with me on Lightning Web Component completely free.
GET IN TOUCH
Schedule a 1:1 Meeting with me
Do not forget to paste your code in comment. It would help others in case they get stuck. Also check out https://salesforcediaries.com/category/lightning-web-component/ to learn more on LWC.