I am trying to learn react and wanted to get an informed opinion on how to best create an application using react.
I learned Reusability is a crucial aspect of React.js development. Meaning the ability to use the same component in multiple places within an application or even in different projects. I wanted to understand this in greater detail.
For understanding purposes, let say my application manages employee.
I create a functional component that has entry field for employee name, address, department, manager, etc.
This functional component can be used in AddEmployee page and UpdateEmployee page like so
export default function AddEmployee () {
.
.
return (
<Employee data={null} display={toDisplay} />
);
}
export default function UpdateEmployee () {
.
.
return (
<Employee data={myData} display={toDisplay} />
);
}
similarly I can create a function component for table that does sorting, pagination, edit and delete where ever table is needed in the application, like so
<Table columns={columns} data={data} flag={isActive} sortBy={sortBy} />
Is my understanding of reusability right or is there more to reusability.
Also if there are other things I should keep in mind while creating a react application that is different from angular please let me know.
Thanks