Put in order · JavaScript and React course · Module 15: Patterns and Architecture

Polymorphic Component Syntax

Arrange the syntax for defining a polymorphic component with the 'as' prop:

Items to put in order

  • return <Component {...props}>{children}</Component>;
  • function SpaceButton({
  • as: Component = 'button',
  • }
  • children, ...props }) {

You can check the correct answer by solving this task in the CodeWorlds game.