I have React application with Tabs that call up separate JS files. I'm using SurveyJS in which every survey has a complete button. On my Parent page, my Save button i need to have it call every JS file , .onComplete method
Example of Parent page with Tabs
import {Tab, Tabs } from 'react-bootstrap';
import * as Survey from "survey-react";
import "survey-react/survey.css";
import SectionA from './SectionA';
import SectionB from './SectionB';
//Tabs
<Tabs activeKey={this.state.activeTab} onSelect={this.handleSelect}>
<Tab eventKey={1} title="CORE SEC A."><SectionA offline={this.state.online} /></Tab>
<Tab eventKey={2} title="CORE SEC B."><SectionB /></Tab>
...
</Tabs>
//Save button function
const sendSurveyDataAPI = () => {
// need to call all the .onComplete on child pages such as SectionA, SectionB (.js files)
}
Child page Example
var survey = new Survey.Model(json);
// need to call up this from Parent
survey
.onComplete
.add(function (result) {
// don't want this in children
handleSave(result.data);
})