This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| State Management: | |
| - Immutable vs Mutable | |
| - Lifting State & Prop Drilling vs. Context | |
| - Derived State | |
| - Rerendering Performance | |
| - Plain: useState / useReducer | |
| ○ mit Immer: https://immerjs.github.io/immer/docs/introduction | |
| ○ mit Constate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from 'react'; | |
| import produce from 'immer'; | |
| import logo from './logo.svg'; | |
| import './App.css'; | |
| import { observable } from 'mobx'; | |
| import { observer } from 'mobx-react'; | |
| interface BlogData { | |
| name: any; | |
| change: Date; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function createConnect<InjectedProps>(injectedProp: string) { | |
| return function connect<ComponentProps>() { | |
| type Props = ComponentProps & InjectedProps; | |
| type Factory = (props: Props) => IReactComponent<Props>; | |
| return (factory: Factory) => { | |
| const fakeProps = {} as Props; | |
| const Component = inject(injectedProp)(observer(factory(fakeProps))); | |
| return (props: ComponentProps) => <Component {...props as Props} />; | |
| }; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "starter", | |
| "version": "0.1.0", | |
| "private": true, | |
| "dependencies": { | |
| "react": "^16.1.1", | |
| "react-dom": "^16.1.1", | |
| "react-scripts": "1.0.17" | |
| }, | |
| "scripts": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "awesome-ng", | |
| "version": "0.0.0", | |
| "license": "MIT", | |
| "scripts": { | |
| "ng": "ng", | |
| "start": "ng serve", | |
| "build": "ng build", | |
| "test": "ng test", | |
| "lint": "ng lint", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function () { | |
| if (new window.Intl.DateTimeFormat('it-CH').format(new Date()).indexOf('.') != -1) return; | |
| var NativeDateTimeFormat = window.Intl.DateTimeFormat; | |
| window.Intl.DateTimeFormat = function (locale) { | |
| //console.log('DateTimeFormat constructed', arguments); | |
| if (!(this instanceof window.Intl.DateTimeFormat)) { // enforce constructor | |
| throw new Error('window.Intl.DateTimeFormat not called as constructor!'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.log(new window.Intl.DateTimeFormat('de-CH', {year:'numeric',month:'numeric',day:'numeric'}).format(new Date())); | |
| console.log(new window.Intl.DateTimeFormat('fr-CH', {year:'numeric',month:'numeric',day:'numeric'}).format(new Date())); | |
| console.log(new window.Intl.DateTimeFormat('it-CH', {year:'numeric',month:'numeric',day:'numeric'}).format(new Date())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.log(new window.Intl.DateTimeFormat('de-CH').format(new Date())); | |
| console.log(new window.Intl.DateTimeFormat('fr-CH').format(new Date())); | |
| console.log(new window.Intl.DateTimeFormat('it-CH').format(new Date())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.log("Hello from script 4!"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.log("Hello from script 1!"); |
NewerOlder