This is possible and a common pattern in React. But it's currently not part of the ECMAScript standard so it will be a while before it's natively implemented. If you're using Babel, look at this plugin.
Here's the proposal for this to happen, it's currently in Stage 3, which means it's a good candidate to be accepted and likely to be implemented.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.