Skip to content

Commit 430a360

Browse files
authored
feat: Pass props along with state for dfp ads (#103)
* feat: Pass props along with state for dfp ads * fix(documentation added for dfp)
1 parent 26619d5 commit 430a360

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/dfp-ad.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {withError} from './with-error';
1919
* export const DfpAd = createDfpAdComponent({
2020
* defaultNetworkID: "123456789",
2121
* config: CONFIG,
22-
* targeting: function(state) {
22+
* targeting: function(state, ownProps) {
2323
* const params = {};
2424
*
2525
* // if(storyIsSponsored) params['sponsor'] = storySponsor
@@ -36,16 +36,16 @@ import {withError} from './with-error';
3636
* @param {Object} params
3737
* @param {string} params.defaultNetworkID - Network Id of the Ad Provider
3838
* @param {Object} params.config - Configuration of the ads (see example)
39-
* @param {function} params.targeting - Function which takes in the current state, and returns targetting parameters
39+
* @param {function} params.targeting - Function which takes in the current state, props from the parent component and returns targetting parameters
4040
* @param {boolean} params.collapseEmptyDivs (default true)
4141
* @param {boolean} params.lazyLoad (default true)
4242
* @param {boolean} params.singleRequest - Run Dfp in Single Request Mode (default false)
4343
* @category Ads
4444
* @returns {Component} A component that can
4545
*/
4646
export function createDfpAdComponent({ defaultNetworkID, config, targeting, collapseEmptyDivs = true, lazyLoad = true, singleRequest = false }) {
47-
return connect((state) => ({
48-
targetingArguments: targeting(state),
47+
return connect((state, ownProps) => ({
48+
targetingArguments: targeting(state, ownProps),
4949
defaultNetworkID: defaultNetworkID,
5050
config: config,
5151
collapseEmptyDivs: collapseEmptyDivs,

0 commit comments

Comments
 (0)