/
test.js
41 lines (36 loc) · 1.01 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { useIntl } from 'react-intl';
function test() {
const intl = useIntl();
// Uncomment either of the following 'error' functions and run `npm run build` to see errors.
// async function error1() {
// await intl.formatMessage({ defaultMessage: 'foo', description: 'foo' });
// }
async function ok1() {
const message = intl.formatMessage({
defaultMessage: 'foo',
description: 'foo',
});
await message;
}
// async function error2() {
// return intl.formatMessage({ defaultMessage: 'foo', description: 'foo' });
// }
async function ok2() {
const message = intl.formatMessage({
defaultMessage: 'foo',
description: 'foo',
});
return message;
}
// async function error3() {
// await console.log(
// intl.formatMessage({ defaultMessage: 'foo', description: 'foo' })
// );
// }
async function ok3() {
const result = console.log(
intl.formatMessage({ defaultMessage: 'foo', description: 'foo' })
);
await result;
}
}