Last active
July 14, 2020 19:27
-
-
Save ravewebdev/1803f8344b70a9251feba8532b496ef5 to your computer and use it in GitHub Desktop.
2.1.2. Use State and Effect hooks to track attribute changes
This file contains 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 FrontendTracker = ( props ) => { | |
// Code from 2.1.1. here... | |
const [ attributes, setAttributes ] = useState( { | |
block_id: 0, | |
} ); | |
useEffect( () => { | |
setAttributes( { | |
...dataAttributes, | |
} ); | |
}, [] ); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment