My experience with React & Co in a large-scale application
src ├── screens │ └── App │ ├── components │ ├── screens │ │ ├── Admin │ │ │ ├── components │ │ │ ├── screens │ │ │ │ ├── Reports │ │ │ │ │ ├── components │ │ │ │ │ └── Reports.screen.tsx │ │ │ │ └── Users │ │ │ │ ├── components │ │ │ │ └── Users.screen.tsx │ │ │ ├── shared │ │ │ │ └── helpers │ │ │ │ └── some.helper.ts │ │ │ └── Admin.screen.tsx │ │ └── Course │ │ ├── components │ │ ├── screens │ │ │ └── AssignmentsList │ │ │ ├── components │ │ │ └── AssignmentsList.screen.tsx │ │ └── Course.screen.tsx │ ├── shared │ │ └── components │ │ ├── Avatar.component.tsx │ │ └── Icon.component.tsx │ └── App.tsx ├── shared └── index.ts
VehicleList.screen.tsx VehicleListFilter.container.tsx VehicleListFilter.component.tsx vehicleListFilter.scss VehicleListFilterChips.component.tsx preventTouchClickMouseEmulation.helper.ts
$breakpoints: (
xxs: 0px,
xs: 480px,
s: 768px,
m: 992px,
l: 1200px,
xl: 1600px
);
$brand-blue: #15577e;
$weight-light: 300;
$font-size-display: (
xxs: (
font-size: 1.900rem,
line-height: 2.375rem,
font-weight: $weight-light
),
xs: (
font-size: 2.000rem,
line-height: 2.500rem,
font-weight: $weight-light
)
);
interface PropsInterface {
count: number;
options: Array<string>;
label?: string | JSX.Element;
type?: 'default' | 'primary' | 'thin';
entity: AsyncModel<InquiryDetails>;
filterKey: keyof OfferFilter;
}
const SomeComponent: React.SFC<PropsInterface> = (props) => {
return ...
};
export interface OfferDetails {
"financingEnabled"?: boolean;
"includedWarranty"?: string;
"leaseAnnualMileage"?: string;
"leaseDownPayment"?: PriceView;
"leaseDuration"?: string;
"leaseRate"?: PriceView;
"leasingEnabled"?: boolean;
"maintenanceBeforeDeliver"?: boolean;
"marketPlace"?: OfferMarketPlaceView;
"offerKey": string;
"price"?: PriceView;
"registrationBeforeDelivery"?: boolean;
"totalPrice"?: PriceView;
"vehicle": VehicleOfferDetails;
"warrantyOffers"?: Array<WarrantyOfferView>;
}
create(params: { "create": VehicleCreate; }, options?: any): (fetch?: FetchAPI, basePath?: string)
=> Promise<VehicleDetails> {
const fetchArgs = VehicleApiFetchParamCreator.create(params, options);
return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => {
return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => {
if (response.status >= 200 && response.status < 300) {
return response.json();
} else {
throw response;
}
});
};
}
.attribute-circle {
...
&-icon {
...
}
&--inner {
...
}
}
attributeCircle.scss
attributeCircle.scss.d.ts
export const attributeCircle: string;
export const attributeCircleInner: string;
export const attributeCircleIcon: string;
Using nonexistent/renamed classnames results in typescript warning
import FlexItem from '../../../../../../../../shared/components/...'
import FlexItem from 'shared/components/...'
filter
table
ModelGenerationListScreen
ModelGenerationListScreen extends AdminEntityListScreen
no extends in React!
works but no warning in IDE / compiler
won't work (JSX syntax error)
ModelGenerationViewScreen
ModelGenerationViewScreen extends AdminEntityViewScreen
no extends in React!
ModelGenerationCreateScreen
ModelGenerationCreateScreen extends AdminEntityCreateScreen
no extends in React!
ModelGenerationEditScreen
ModelGenerationEditScreen extends AdminEntityEditScreen
no extends in React!
Then God blessed them and said, "Be fruitful and multiply. Fill the earth and govern it. Reign over the fish in the sea, the birds in the sky, and all the animals that scurry along the ground."
Book of Genesis 1:28