Creating a WidgetRenderer

Learn how to use Bootstrap styles to make a React component that renders the IWidget data type.

It’s time to render more than just the title and description properties of our IWidget type. Let’s make a new component, WidgetRenderer. Unlike the previous components we’ve seen, WidgetRenderer will accept the IWidget type directly as its property type. This way, we can use spread syntaxAllows an iterable such as an array expression or string to be expanded in places where zero or more arguments are to be used. to pass in each widget directly.

Unstyled rendering of all widget properties

First, let’s render all properties of our widgets, each within a <p> tag.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy