sometimes we load something in es6 like:
import FlatList from 'react-native';
but sometimes we covered this imported object with curly brackets like
import {'FlatList'} from 'react-native';
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".
It's entirely up to the module authors to export it as they see fit. You should consult the documentation to know how to import it for sure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With