I
I
Ivan Derbenchenko2021-08-05 15:42:23
React
Ivan Derbenchenko, 2021-08-05 15:42:23

Exporting and importing React components, which is better?

Greetings to all who responded!
Help the green developer figure it out)
here is the code

// Foo.jsx
export const Foo = ()=>{
    //  ...code
}

// Bar.jsx
const Bar = ()=>{
    //  ...code
}
export default Bar


Accordingly, their imports are also different

import {Foo} from './Foo'

import Bar from '.Bar'

I know that the last option can still be renamed when importing in another file.
What are the other differences between these exports, besides visual differences, what is better to use?
Please do not throw stones

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
approximate solution, 2021-08-05
@Mr_FabiozZz

You need to download the Google skill:
Difference between export {name}, export default {name}?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question