Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

how to differentiate Between 2 identical action

ahmedt
Tera Contributor

Hello All,
I have a problem with default component ,if i have 2 of same component in the custom component they both fire the same action with the same payload so i can not tell the difference between them 

Example:

import { createCustomElement, declarativeOperations } from '@servicenow/ui-core';
import snabbdom from '@servicenow/ui-renderer-snabbdom';
import '@servicenow/now-toggle';
const view = (state, { updateProperties, updateState }) => (
	<div>
	
		<now-toggle data-field="email" id="masadjaskld"/>
		<now-toggle data-field="notifications"/>
	<button on-click={e => updateState({
		path: 'math',
		value: 2,
		operation: declarativeOperations.SET
	})}>Hello !</button>
	<p>{JSON.stringify(state)}</p>
</div>
);

createCustomElement('my-element', {
	renderer: { type: snabbdom },
	view,
	properties: {
		name: { default: 'Fred' }
	}, setInitialState() {
		return {
			animals: {
				cats: 1,
				oo: { mn: "rec" }
			}
		};
	},actionHandlers:{
		'NOW_TOGGLE#CHECKED_SET': {
			effect(coeffects
			) {

  
			}
		}
	}
});

 I tried by DOM variables but i can not get the DOM element from the action 

0 REPLIES 0