Answer the following questions, based on what we have just learned:
- During development, what are the TSLint settings for allowing debugger statements and logging to the console?
- In JSX, how can we display a button with a label from a prop called buttonLabel in a class component?
- How can we make the buttonLabel prop optional, and default to Do It?
- In JSX, how can we display this button only if the doItVisible state is true? (Assume we already have a state type declared containing doItVisible, and it has already been initialized in the constructor.)
- How would we create a click handler for this button?
- We have a state type declared containing doItDisabled. It has also been initialized in the constructor. How would we set this state to disable the Do it button after we click it?
- If the button is clicked when it is in a disabled state, is the click handler still executed?
- What life cycle method would we use in a class component to add event handlers to a non-React web component living in our React component?
- Which life cycle method would we use to remove this event handler?
- We have a function component called Counter. It needs to contain a piece of state called count, and a function to update it called setCount. How can we define this state and default the initial count to 10?
- In the preceding Counter component, we have a decrement function that needs to reduce count by 1.
const decrement = () => {
// TODO - reduce count by 1
};
How can this be implemented?