Skip to content

Instantly share code, notes, and snippets.

@AsishP
Last active January 6, 2019 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AsishP/f1cc800052f81e8a1898bdf758981c8e to your computer and use it in GitHub Desktop.
Save AsishP/f1cc800052f81e8a1898bdf758981c8e to your computer and use it in GitHub Desktop.
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