Customizing onRender

Learn how to improve our application's user interface by changing the rendered text according to the functionality.

Updating the form buttons

Now that we have our views refactored, let’s improve our user interface slightly:

  • When the user is creating a new contact, the form’s button should read “Create contact.”

  • When the user is updating an existing contact, the form’s button should read “Update contact.”

Right now, our form has the generic “Save” text on it. We’ll leave that since it will serve as a generic fallback. However, now that the onRender function is defined in each view, we can specify different behavior adapted to the view’s needs. Let’s first change the new form button’s text:

Get hands-on with 1200+ tech skills courses.