-
-
Save ochafik/bdbfdbe6ebc1a0feee3e45e92a837e9d to your computer and use it in GitHub Desktop.
Angular TypeScript -> React
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
| const Angular = { | |
| createElement() { | |
| } | |
| }; | |
| /* | |
| @Component( | |
| selector: 'my-component', | |
| template: `<div>{{ name }}</div>`, | |
| styles: [` | |
| :host { | |
| color: red; | |
| } | |
| `] | |
| ) | |
| class MyComponent { | |
| @Input() name: string; | |
| } | |
| @Component( | |
| selector: 'my-app', | |
| directives: [MyComponent], | |
| template: ` | |
| <my-component *ngFor"let name of names" | |
| [name]="name"> | |
| </my-component> | |
| ` | |
| ) | |
| class MyApp { | |
| @Input() names: string[]; | |
| } | |
| */ | |
| const MyComponent = (props: {name: string}) => <div><div>{ props.name }</div></div>; | |
| const MyApp = (props: {names: string[]}) => | |
| <div> | |
| { | |
| props.names.map(name => | |
| <MyComponent name="1"></MyComponent> | |
| ) | |
| } | |
| </div>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment