Skip to content

Instantly share code, notes, and snippets.

@ochafik
Created October 18, 2018 00:43
Show Gist options
  • Select an option

  • Save ochafik/bdbfdbe6ebc1a0feee3e45e92a837e9d to your computer and use it in GitHub Desktop.

Select an option

Save ochafik/bdbfdbe6ebc1a0feee3e45e92a837e9d to your computer and use it in GitHub Desktop.
Angular TypeScript -> React
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