Composing Components
Now that we have a component for each seat, we want to combine multiple seats into a row and then combine multiple rows into a venue. Invoking a component from another component normally involves a JSX call that looks as though the component was an HTML tag with the name of the component first and the props following with the same syntax used to write HTML attributes.
So if we want to use our Seat component, weâd call it with syntax like <Seat seatNumber={seatNumber} />. The first part of the tag is our component name, and then we assign the prop as if it were an HTML attribute using the curly bracket notation to send the value of the seat number. If the value being sent is a string, you can use a string literal rather ...
Get Modern Front-End Development for Rails, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.