Skip to content
Advertisement

React connecting info between App.js and a class

I am trying to integrate React Scheduler into my app that uses JSON data base. how can I pass the shifts and functions defined in App.js that update the data to DataSheet.js and use them instead of the defaults? Is there a better way to enable the database update from the DataSheet?

App.js:

JavaScript

DataSheet.js:

JavaScript

Advertisement

Answer

Pass the data as props from parent component App and capture it from the child component DataSheet.

App

JavaScript

Inside Datasheet component you can use them as this.props.shifts and this.props.addShift.

Advertisement