1

How should I import a library/module into React-Native and make it available in multiple components?

Is there a standard way of doing this without having to import, and configure, the library in every component?

1 Answer 1

2

I usually handle these situations by creating my own wrapper module that configures and exports the library. Then when I use it in my app, I use the local wrapper module. For example:

myLibrary.js

import library from 'library'; library.configure({ /* options */ }); export default library; 

someOtherModule.js

import library from './myLibrary'; library.doThings(); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.