The App.js file For A Sacred Scriptures App

import { useState } from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import Bible from './Bible';
import Quran from './Quran';
import Bhagavadgita from './Bhagavadgita';
import Dhammapada from './Dhammapada';
import Contemplations from './Contemplations';

function App() {
const [selectedComponents, setSelectedComponents] = useState({
bible: false,
quran: false,
bhagavadgita: false,
dhammapada: false,
contemplations: false,
});

const handleItemClick = (component) => {
setSelectedComponents({
...selectedComponents,
[component]: !selectedComponents[component],
});
};

const handleAllClick = () => {
const allSelected = Object.values(selectedComponents).every((value) => value);
const updatedComponents = {};

for (const key in selectedComponents) {
updatedComponents[key] = !allSelected;
}

setSelectedComponents(updatedComponents);
};

return (



{selectedComponents.bible && }
{selectedComponents.quran && }
{selectedComponents.bhagavadgita && }
{selectedComponents.dhammapada && }
{selectedComponents.contemplations && }

} />


);
}

export default App;

Related Articles

Responses

dainis w michel