Skip to content

Commit ef7258e

Browse files
committed
using @loadable/component to dynamically load components on the client's side. Not functional yet
1 parent c8b4d79 commit ef7258e

File tree

3 files changed

+47
-8
lines changed

3 files changed

+47
-8
lines changed

package/linkFiber.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
/* eslint-disable no-param-reassign */
44
// links component state tree to library
55
// changes the setState method to also update our snapshot
6+
7+
// import loadable from '@loadable/component';
8+
69
const Tree = require('./tree');
710
const astParser = require('./astParser');
811
const { saveState } = require('./masterState');
@@ -140,13 +143,13 @@ module.exports = (snap, mode) => {
140143
if (action === 'contentScriptStarted') sendSnapshot();
141144
});
142145
// Testing sending back a function def to client
143-
// if (astHooks) {
144-
// function consoleLoggerTest(someString) {
145-
// return someString;
146-
// }
147-
// const testFunction = consoleLoggerTest('Hello from reactime');
148-
// return testFunction;
149-
// }
150-
return "This is reactime's return statement";
146+
function getNextImport(filePath) {
147+
// return loadable(() => import(`${filePath}`))
148+
// Got relative file path to return back to client code
149+
return (`myTestString${filePath}`);
150+
}
151+
return getNextImport('./UseStateHook');
152+
// return 'Testing outside';
151153
};
152154
};
155+
// const OtherComponent = loadable(() => import('./OtherComponent'))

package/package-lock.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
],
3434
"license": "MIT",
3535
"dependencies": {
36+
"@loadable/component": "^5.10.3",
3637
"acorn": "^7.1.0",
3738
"acorn-jsx": "^5.0.2"
3839
}

0 commit comments

Comments
 (0)