Coding task · JavaScript and React course · Module 1: React Basics

Practice: React.createElement

React.createElement(type, props, ...children) is the call Babel turns JSX into. The type can be a tag name ('div') or a component (SpaceshipPart).

Task

Without JSX: inside the App component, use React.createElement to create an element of the SpaceshipPart component with the name and type properties (e.g. name: 'Engine', type: 'propulsion') and return it. SpaceshipPart itself should display the part's name and type.