- Please write the answer to the questions 1 and 2 in a word document.
- Commit and push the React App and the word document to a new branch with your name.
What are microtasks? What is a microtask queue? What is their role in Promises and how are they different from callbacks?
Explain with examples how private, protected variables can be implemented in classes and how can they be used in subclasses?
We store a lot of form data in our databases. A frequent task would be to fetch the form data, render it, validate it and modify any changes. The following is a basic implementation of such a function: Feel free to use any boilerplate (like CRA) or UI framework (like Material UI) you want.
We care about code that is readable (even without comments), non-repeating (within reason) and structured well. Avoid third party libraries for form handling (like react-form, simple-react-form etc).
-
Should take an array of objects as an input. Use the following as an example (but feel free to change the field names or add/remove fields).
const formItems = [ { id: 1, type: "string", required: true, field: "name", value: "Waterlabs" }, { id: 2, type: "number", required: true, field: "age", value: 1 }, ... ]
-
Each field must have validations:
- Required / Not Required
- Number, String and Email
- Min/Max length
- Show validation errors with a red colour indication.
- Put in a reset button and a submit button.
- On submit, any errors should be displayed at the bottom of appropriate field.
- If successful, update the form object.
- Bonus: If you can implement this with the form data fetched and updated using MobX, context API or Redux.