Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import * as React from 'react';
import { ChildComponentState } from './ChildComponentState';
import { WebPartContext } from '@microsoft/sp-webpart-base';
export interface ChildComponentProps
{
context : WebPartContext;
childoutput?: (item: any) => void;
}
export default class ChildComponent extends React.Component<ChildComponentProps, ChildComponentState> {
constructor()
{
super();
this.state = {
stateprop1 : "",
stateprop2 : this.props.prop1
};
}
public componentWillMount()
{
...
}
/**
* Any event method to set the value
* @param item
*/
private _onItemChange = (item: any) => {
const { childoutput } = this.props;
if (childoutput) {
childoutput(item);
}
}
public render(): React.ReactElement<ChildComponentProps> {
return (
<div> .. </div>
)};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.