Last active
June 19, 2021 20:43
-
-
Save sabesansathananthan/0cfb6e88d6b8fcf53fccca4f146e22cc to your computer and use it in GitHub Desktop.
How React Components Are Reused
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use this method instead... | |
MyComponent.someFunction = someFunction; | |
export default MyComponent; | |
// ...Export the method separately... | |
export { someFunction }; | |
// .. and in the components to be used, import them | |
import MyComponent, { someFunction } from "./MyComponent.js"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment