Last active
January 16, 2019 14:29
-
-
Save marcelmokos/b987a37e46e3fc6796e3ecda8b2aff94 to your computer and use it in GitHub Desktop.
Openslava
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 FormattedNumber = ({ value, roundingFn = val => val }) => roundingFn(value); | |
//js | |
console.log( | |
FormattedNumber({value: 5.6}) /* 5.6 */ | |
); | |
//jsx | |
<FormattedNumber value={5.6} /> /* 5.6 */ | |
<FormattedNumber value={5.6} roundingFn={Math.floor} /> /* 5 */ | |
<FormattedNumber value={5.6} roundingFn={Math.ceil} /> /* 6 */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment