Hi I need to help with my method for creating list of custom components. This method has same logic for 4 components (Package,Theme,Part, Knowledges). Only one thing i have to change is component which i pushing to list.
I tried something like this, but this throw weird error:
index.js:1 Warning: <Package /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.
export class SubjectDashboardUtils {
/**
* Make list of Components of certain type
* @param {[]} list
* @param {Number} itemType
* @return {any} items
*/
static makeListOfTypedItems(list: [], itemType: string): any {
console.log(list);
console.log(itemType);
const items = [];
list.forEach((item, key) => {
const subjectPartComponent = React.createElement('Package', {key: key, data: item}, itemType);
items.push(subjectPartComponent);
});
return items;
}
}