Do you want to write better React? In that case, you shouldn’t use it with JavaScript. Why? Because JavaScript isn't compatible with React's core principles, meaning you need to mimic them using many external libraries. Fortunately, Reason is here and ready to help you out through writing safer and cleaner React code, thanks to its type system which is superior to TypeScript and Flow. You'll need much less dependencies and you get less complexity regarding the choices you need to make because React's core features are built-in in Reason.
24. @coding_lawyer
let fizzbuzz = (i) =>
switch (i mod 3, i mod 5) {
| (0, 0) => "FizzBuzz"
| (0, _) => "Fizz"
| (_, 0) => "Buzz"
| _ => string_of_int(i)
};
for (i in 1 to 100) {
Js.log(fizzbuzz(i))
};
26. @coding_lawyer
function fizzbuzz(i) {
var match = i % 3
var match$1 = i % 5
if (match !== 0) {
if (match$1 !== 0) {
return String(i)
} else {
return 'Buzz'
}
} else if (match$1 !== 0) {
return 'Fizz'
} else {
return 'FizzBuzz'
}
}
for (var i = 1; i <= 100; ++i) {
console.log(fizzbuzz(i))
}
let fizzbuzz = (i) =>
switch (i mod 3, i mod 5) {
| (0, 0) => "FizzBuzz"
| (0, _) => "Fizz"
| (_, 0) => "Buzz"
| _ => string_of_int(i)
};
for (i in 1 to 100) {
Js.log(fizzbuzz(i))
};