Skip to main content
Improved formatting for readability
Source Link
Drew Reese
  • 207.2k
  • 19
  • 280
  • 293

I want to do is iI want to import react nativeReact-Native dynamic path.

example  :- import Demo from ./screens/${path};

import Demo from `./screens/${path}`; 

currently iI found one method using lazy.but, but it also only working when inisializeinitialize const variable like this

 const demo = 'Path'; let componentPath = `../Screen/${demo}`; const DynamicComponent = React.lazy(() => import(componentPath).then(module => ({default: module.screenm})), ); 
const demo = 'Path'; let componentPath = `../Screen/${demo}`; const DynamicComponent = React.lazy(() => import(componentPath) .then(module => ({ default: module.screen })), ); 

iI want to get path by async storage saved variable., not like hard code variable.when i When I hard code variable and it works., but iI could not be able to get it formfrom async storage. iI have trytried to find method to do it . but i could not be able to do it. is there any method to do it.

I want to do is i want to import react native dynamic path.

example  :- import Demo from ./screens/${path};

currently i found one method using lazy.but it also only working when inisialize const variable like this

 const demo = 'Path'; let componentPath = `../Screen/${demo}`; const DynamicComponent = React.lazy(() => import(componentPath).then(module => ({default: module.screenm})), ); 

i want to get path by async storage saved variable. not like hard code variable.when i hard code variable and it works. but i could not be able to get it form async storage. i have try to find method to do it . but i could not be able to do it. is there any method to do it.

I want to do is I want to import React-Native dynamic path.

example:

import Demo from `./screens/${path}`; 

I found one method using lazy, but it also only working when initialize const variable like this

const demo = 'Path'; let componentPath = `../Screen/${demo}`; const DynamicComponent = React.lazy(() => import(componentPath) .then(module => ({ default: module.screen })), ); 

I want to get path by async storage saved variable, not like hard code variable. When I hard code variable it works, but I could not get it from async storage. I have tried to find any method to do it.

edited tags
Link
Drew Reese
  • 207.2k
  • 19
  • 280
  • 293
Source Link
kavindu
  • 46
  • 1
  • 6

Dynamic import path for React Native

I want to do is i want to import react native dynamic path.

example :- import Demo from ./screens/${path};

currently i found one method using lazy.but it also only working when inisialize const variable like this

 const demo = 'Path'; let componentPath = `../Screen/${demo}`; const DynamicComponent = React.lazy(() => import(componentPath).then(module => ({default: module.screenm})), ); 

i want to get path by async storage saved variable. not like hard code variable.when i hard code variable and it works. but i could not be able to get it form async storage. i have try to find method to do it . but i could not be able to do it. is there any method to do it.