The QuestionCard Component
Learn how to import named components and questions.
Importing questions into the App component
Because the questions exported from the QuestionData.js
file are named export, we have to use a different method to import the named export components. Unlike the default export, we have to use {}
while importing the named export. This is shown in the following code snippet:
// default import
import ComponentName from "./Component/ComponentName"
// named import
import {ComponentName} from "./Component/ComponentName"
As a result, the following code sample demonstrates how we import the questions:
Importing the questions into the application
Update the QuestionCard
component
We have to create a layout to display the questions and options on the screen for our users. Our ...