Sheets
You can modify sheet by changing your data. SpreadSheet will act as a controlled and uncontrolled component based on the props
that is injected
SpreadSheet
as controlled component
Using const App = () => {
const [sheets, setSheets] = useState()
return (
<SpreadSheet
sheets={sheets}
onChange={newSheet => setSheets(sheets)}
/>
)
}
SpreadSheet
as uncontrolled component
Using const App = () => {
const [sheets, setSheets] = useState()
return (
<SpreadSheet
initialSheets={sheets}
onChange={newSheet => setSheets(sheets)}
/>
)
}
Initializing Active sheet
const defaultSheets = [
{
name: 'Sheet 1',
cells: {},
id: 1
},
{
name: 'Sheet 2',
cells: {},
id: 2
}
]
const App = () => {
const [sheets, setSheets] = useState(defaultSheets)
return (
<SpreadSheet
sheets={sheets}
activeSheet={2}
/>
)
}
fx
Sheet 1
Sheet 2