Placeholder control documentation sample code
See original GitHub issueQuestion
Please specify what version of the library you are using: [ 1.14.0 ]
Observed Behavior
Documentation at below link says to use below code to put placeholder control https://sharepoint.github.io/sp-dev-fx-controls-react/controls/Placeholder/
<Placeholder iconName='Edit' iconText='Configure your web part' description='Please configure the web part.' buttonLabel='Configure' onConfigure={this._onConfigure} />
But if we put like above, ’ this.props’ is coming as undefined, as ‘this’ is referring to placeholder control itself. To make it work I had to use like below
<Placeholder iconName='Edit' iconText='Configure your web part' description='Please configure the web part.' buttonLabel='Configure' hideButton={this.props.displayMode === DisplayMode.Read} onConfigure={() => this._onConfigure()} />
is this because of react version? Below is my package.json which has all version. If above is correct way to bind method, documentation needs to be updated.
{ "name": "react-recaptcha", "version": "0.0.1", "private": true, "engines": { "node": ">=0.10.0" }, "scripts": { "build": "gulp bundle", "clean": "gulp clean", "test": "gulp test" }, "dependencies": { "@microsoft/sp-core-library": "1.8.2", "@microsoft/sp-lodash-subset": "1.8.2", "@microsoft/sp-office-ui-fabric-core": "1.8.2", "@microsoft/sp-property-pane": "1.8.2", "@microsoft/sp-webpart-base": "1.8.2", "@pnp/spfx-controls-react": "1.14.0", "@types/es6-promise": "0.0.33", "@types/react": "16.7.22", "@types/react-dom": "16.8.0", "@types/react-google-recaptcha": "^1.1.0", "@types/webpack-env": "1.13.1", "office-ui-fabric-react": "6.143.0", "react": "16.7.0", "react-async-script": "^1.1.1", "react-dom": "16.7.0", "react-google-recaptcha": "^2.0.1" }, "resolutions": { "@types/react": "16.7.22" }, "devDependencies": { "@microsoft/sp-build-web": "1.8.2", "@microsoft/sp-tslint-rules": "1.8.2", "@microsoft/sp-module-interfaces": "1.8.2", "@microsoft/sp-webpart-workbench": "1.8.2", "@microsoft/rush-stack-compiler-2.9": "0.7.7", "gulp": "~3.9.1", "@types/chai": "3.4.34", "@types/mocha": "2.2.38", "ajv": "~5.2.2" } }
Thanks!
Sidddharth
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (6 by maintainers)
Top GitHub Comments
@joelfmrodrigues - yes we can close this…
Using an arrow function like suggested in current documentation should work: https://pnp.github.io/sp-dev-fx-controls-react/controls/Placeholder/
@siddharth-vaghasia happy for the issue to be closed?