Very well sussed out 🙂. If I could suggest a one things that might make things easier for you.
As we're dealing with a toggle rather than storing you text in a state you could store a Boolean. Doing this make our inverting logic a lot simpler it also means we can do other things with with the state (like change the button colour).
thank you for the suggestion. You are right, we can do that.
When I decided to write this blog, my main motive was to only focus on one functionality and explain end to end process of solving the problem, I would agree, if anyone if looking for more flexibility in their code base, your advice is very useful.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Very well sussed out 🙂. If I could suggest a one things that might make things easier for you.
As we're dealing with a toggle rather than storing you text in a state you could store a Boolean. Doing this make our inverting logic a lot simpler it also means we can do other things with with the state (like change the button colour).
thank you for the suggestion. You are right, we can do that.
When I decided to write this blog, my main motive was to only focus on one functionality and explain end to end process of solving the problem, I would agree, if anyone if looking for more flexibility in their code base, your advice is very useful.