Created
August 5, 2018 17:06
-
-
Save revanth0212/28d229cb11222f4eba34448d40fbd165 to your computer and use it in GitHub Desktop.
A sample to show how to use the field changes calculator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const calculator = require('field-change-effects-calculator'); | |
const changesCalculator = calculator(rules); | |
const calculateChanges = (event) => { | |
const state = getState() | |
const { name, value } = event.target | |
const changes = changesCalculator(state)(name, ['path', 'of', 'field', 'in', 'the', 'state', 'object'], value) | |
return changes | |
} | |
// HTML | |
<input type="text" name="country" onBlur="calculateChanges()" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment