QuizzesProject Structure and TypeScript Conventions — Concept Check
intermediate
nextjs

Project Structure and TypeScript Conventions — Concept Check

Questions on Project Structure and TypeScript Conventions. The app directory is routing, not architecture. Deciding what belongs beside a route and what belongs in a shared layer is what keeps a Next codebase navigable past twenty routes.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on Project Structure and TypeScript Conventions — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer places all components under the `app` directory in a Next.js project. What issue might arise from this structure?

    • AEasier to manage imports with a single directory
    • BDifficulty in navigating the codebase as the project grows
    • CIncreased security by isolating components
    • DImproved performance due to centralized components
  2. 2.A team decides to keep a parallel `components` tree outside the `app` directory. What is a potential drawback of this approach?

    • AEnhanced performance due to isolated components
    • BSimplified routing and URL management
    • CImproved code modularity and separation of concerns
    • DDifficulty in determining component usage across routes
  3. 3.In a Next.js project, a developer notices that a component used by multiple routes is placed inside the `app` directory. What should they do?

    • AKeep the component in `app` for easier access
    • BDuplicate the component in each route folder
    • CConvert the component into a server-only module
    • DMove the component outside `app` to a shared directory
  4. 4.Which TypeScript convention helps catch route mistakes in a Next.js project?

    • AColocating components with routes
    • BInline fetch calls in pages
    • CUsing `client-only` imports
    • DTyped routes in `next.config.js`
  5. 5.A developer uses inline fetch calls scattered through pages for data fetching. What is a better approach according to conventions?

    • AUse global fetch calls in `next.config.js`
    • BKeep using inline fetch calls for simplicity
    • CUse a `queries.ts` file per feature
    • DPlace fetch calls inside `app` components
  6. 6.What is the recommended naming convention for route folders in a Next.js project?

    • APascalCase folders
    • BcamelCase folders
    • Csnake_case folders
    • Dkebab-case folders
  7. 7.A developer prefixes a server-only module with `import 'server-only'`. What happens if a client tries to import it?

    • AThe module is ignored during the build
    • BThe client-side import works but with reduced performance
    • CThe import succeeds with a warning
    • DThe build fails, preventing client-side import
  8. 8.In a Next.js project, what should be minimized in `next.config.js` to maintain a clean configuration?

    • ABusiness logic
    • BServer actions
    • CRedirects and image domains
    • DTyped routes