Last active
January 16, 2021 10:19
-
-
Save davelosert/6aecf4a086b87ca35b4fd8ee91bad71d to your computer and use it in GitHub Desktop.
Beispiel für Subkomponenten-State
This file contains 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 { Menu } from './Menu'; | |
import { MenuModel } from './MenuModel'; | |
import React from 'react'; | |
export class App extends React.Component<any, IAppState> { | |
public constructor (props: any) { | |
super(props); | |
const mockMenuService: MockMenuService = new MockMenuService(); | |
const menu: MenuModel = mockMenuService.getMenu(); | |
this.state = { | |
menu, | |
content: 'Content1' | |
}; | |
} | |
public render (): JSX.Element { | |
return ( | |
<React.Fragment> | |
<Menu menu={this.state.menu} /> | |
<Content content={this.state.content} /> | |
</React.Fragment> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment