P
P
pcdesign2019-03-13 11:56:02
React Native
pcdesign, 2019-03-13 11:56:02

How to dynamically load json files from a project folder?

There are json files

1.json
2.json
3.json
и т.д.

If I call it this way, then everything works. But if I do this:
var ob = require('1.json');
var fn = category_id + '.json';
var ob = require(fn);

then it crashes with an error: "not declared as a system.registerdynamic dependency of module"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Alexandrovich, 2019-03-13
@pcdesign

here is your problem and a solution
https://dev.to/emilios1995/dynamic-imports-in-reac...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question