Ahm*_*hel 3 javascript ecmascript-6 vue.js react-native
sometimes we load something in es6 like:
import FlatList from 'react-native';
Run Code Online (Sandbox Code Playgroud)
but sometimes we covered this imported object with curly brackets like
import {'FlatList'} from 'react-native';
Run Code Online (Sandbox Code Playgroud)
please tell me when should use this brackets or not.
This is the difference between a named export and a default export. Ref
If the module exports a module as a default (ex: export default FlatList;), it can be accessed by import FlatList from "react-native".
If it's a named export (ex: export const FlatList;), it will have to be imported as import {FlatList} from "react-native".
完全由模块作者根据自己的意愿导出它。您应该查阅文档,以确保确定如何导入它。
| 归档时间: |
|
| 查看次数: |
99 次 |
| 最近记录: |