Giter Site home page Giter Site logo

nextjs-14-app's Introduction

Next.js App Router Course - Starter

This is the starter template for the Next.js App Router Course. It contains the starting code for the dashboard application.

For more information, see the course curriculum on the Next.js Website.

Code style guidelines

Root functions

Use function instead of const syntax when declaring functions located on the file's root.

// ❌
const MyReactComponent = () => {
  // ...

  const handleButtonClick = () => {
    // ...
  }
}

// ✅
function MyReactComponent() {
  // ...

  const handleButtonClick = () => {
    // ...
  }
}

Why

This is just a matter of preference, but it visually highlights which are root vs. inner functions, so it is easier to understand which functions are more suitable to be exported or where to start reading in larger files.

No inline exports

As a general rule, do not use inline exports. Instead, put all exports at the end of the file.

// ❌
export type MyComponentProps = {
  /* ... */
}

export function MyComponent(props: MyComponentProps) {
  // ...
}

// ✅
type MyComponentProps = {
  /* ... */
}

function MyComponent(props: MyComponentProps) {
  // ...
}

export type { MyComponentProps }
export { MyComponent }

nextjs-14-app's People

Contributors

ricardomarsanc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.