Closed jantimon closed 4 years ago
Implication / downside if we use a static function would be that we would loose the capability of minification from GondelReactLoaderComponent.create
into eg. c
(minified function name) but C.create
, that would be 7 characters per usage which could not get minified. Imo we can ignore these 5 characters as they won't blow up the bundle size compared to libraries or any other code we possibly have which isn't optimized for minification.
Providing examples for the static version:
const GondelReactLoaderComponent = GondelReactLoaderComponent.create(() => import('./App'));
@Component("Greeter")
class Greeter extends GondelReactLoaderComponent {
const GondelReactLoaderComponent = GondelReactLoaderComponent.create(() => import('./App'), 'App');
@Component("Greeter")
class Greeter extends GondelReactLoaderComponent {
const loader = () => import('./App');
@Component("Greeter")
class Greeter extends GondelReactLoaderComponent.create(loader) {
const loader = () => import('./App');
@Component("Greeter")
class Greeter extends GondelReactLoaderComponent.create(loader, 'App') {
@Component("Greeter")
class Greeter extends GondelReactLoaderComponent.create(() => import('./App')) {
@Component("Greeter")
class Greeter extends GondelReactLoaderComponent.create(() => import('./App'), 'App') {
@ernscht and @smollweide prefer GondelReactComponent.create
too
@jantimon should we finalize this in this week? :)
would be cool, then I could update the examples.. :-)
This enhancement will:
stop
The name
createGondelReactLoader
is still open for discussion - we could also turn it into a static function e.g.GondelReactComponent.create
base syntax
for default export:
for named export:
emphasize the loader
for default export:
for named export:
compact syntax
for default export:
for named export: