Updating the Client: `flashMessage` Component

Learn how to set the flashMessage component to show the message on the current screen.

Updating component.js

In the previous updates, we’ve been assuming that setting the flashMessage field of state will show the message on the current screen, be it the sign-in screen or the game playing screen. To make this happen, we need to add a component that displays this message, and we need to pass the flashMessage down to it.

The component itself will be a simple p element containing the text, but only when it is present. We’ll place this in the components.js file.

Get hands-on with 1400+ tech skills courses.