Skip to content

Instantly share code, notes, and snippets.

@alxhub
alxhub / tree-shakeable-providers.ts
Created March 16, 2018 19:04
Tree-shakeable providers Example
// Here's a fictitious LayoutService without a module!
//
// It'll automatically be available in the application's
// root injector (as if it was provided in the AppModule).
//
// Even though it's in the root injector, if this service
// is only used in a lazy loaded context, it will be lazy
// loaded!
@Injectable({
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };