1

I'm currently writing a paper on my react frontend and I'm struggeling to find the right verb for the interaction between child-components and components in react.

For example:

"I have a table component which ?inherits? from the child components tableHeader and tableBody."

Is the use of inheritance correct here or how should I describe it?

EDIT: Here is a example code of my table

import React from 'react';
import TableHeader from './tableHeader';
import TableBody from './tableBody';
// Stateless Functional Component
const Table = ({ columns, sortColumn, onSort, data }) => {
 return (
 <table className="table">
 <TableHeader
 columns={columns}
 sortColumn={sortColumn}
 onSort={onSort}
 />
 <TableBody columns={columns} data={data} />
 </table>
 );
};
export default Table;
asked Apr 17, 2020 at 15:06

1 Answer 1

1

Inheriting from children is highly unnatural :) I would say that a Table component likely wraps or contains TableHeader and TableBody components, and renders them as its children.

answered Apr 17, 2020 at 15:28

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.