I have an arrow function that get exported and used in another file (I'm using React, but it doesn't matter). In my function I have an object with some properties. However I can't seem to access the object.
I tried 2 approaches:
1. Export in export:
I tried exporting inside an existing export, but that didn't work:
export const TextComponent = ({ text }) => {
export const Props = {
text: [text]
}
return <p>{Props.text}</p>
}
2. Trying to access it in another file without an export
like:
export const TextComponent = ({ text }) => {
const Props = {
text: [text]
}
return <p>{Props.text}</p>
}
//file 2
TextComponent.Props ...
None of these seem to work, is there a way to access this object from a function in another file?