Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update App.js #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions 04-accordion/final/src/App.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
// Importing React and useState for component creation and state management
import React, { useState } from 'react';

// Importing the data array from an external file
import data from './data';

// Importing the SingleQuestion component to display individual questions
import SingleQuestion from './Question';

function App() {
// Initializing state to hold the questions data
const [questions, setQuestions] = useState(data);

return (
<main>
<div className='container'>
{/* Page heading */}
<h3>questions and answers about login</h3>

{/* Section to display the list of questions */}
<section className='info'>
{/* Mapping through the questions array to render each question */}
{questions.map((question) => {
return (
// Rendering SingleQuestion component for each question with props spread
<SingleQuestion key={question.id} {...question}></SingleQuestion>
);
})}
Expand All @@ -19,4 +32,5 @@ function App() {
);
}

// Exporting the App component as the default export
export default App;