Closed Hrommi closed 4 years ago
Survey-analytics is in beta now. It doesn't demonstrated in our demos for while. We can add survey-analytics in our ReactJS boilerplate repo - https://github.com/surveyjs/surveyjs_react_quickstart and check it. But it will take some time.
From the other hand it would be nice if you provide us with a minimal sample to reproduce the issue
I created simple demo survey-analytics-react.zip
The "out of memory" issue is related to the "create-react-app" toolkit.
I fount ""react-scripts" FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory" and got the corresponding issue https://github.com/facebook/create-react-app/issues/4436 in the create-react-app repository
I've added another start script to the package.json file:
"start1": "node --max-old-space-size=4000 node_modules/react-scripts/scripts/start.js",
and command "npm run start1" worked ok for me
After that I've got another issue - "TypeError: Cannot read property 'frameworkUsing' of undefined" - and right now investigating it
The "TypeError: Cannot read property 'frameworkUsing' of undefined" error is caused by wrong data normalization code.
You need to use the
const normalizeData = data.map(function(item) {
questions.forEach(function(q) {
if (item[q.name] === undefined) {
item[q.name] = "";
}
});
return item;
});
code instead of
const normalizeData = data.map(item => {
questions.forEach(q => {
if (item[q.name] === undefined) {
item[q.name] = "";
}
return item;
});
});
"start1": "node --max-old-space-size=4000 node_modules/react-scripts/scripts/start.js"
It's works for me. Thank you.
I only add
import * as SurveyAnalytics from "survey-analytics"
in my react component. I get error afternpm start
:React version 16.12.0. NPM version 6.9.0 Survey-analytics version 1.1.24.
What is the best way to use "survey-analytics" in React project?