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 frequently asked questions in documentation #34252

Merged
merged 18 commits into from Feb 12, 2022
67 changes: 32 additions & 35 deletions docs/faq.md
Expand Up @@ -5,65 +5,67 @@ description: Get to know more about Next.js with the frequently asked questions.
# Frequently Asked Questions

<details>
<summary>Is this production ready?</summary>
<p>Next.js has been powering <a href="https://vercel.com">https://vercel.com</a>  since its inception.</p>

<p>We’re ecstatic about both the developer experience and end-user performance, so we decided to share it with the community.</p>
</details>

<details>
<summary>How big is it?</summary>
<p>The client side bundle size should be measured in a per-app basis. A small Next main bundle is around 65kb gzipped.</p>
</details>

<details>
<summary>How can I change the internal webpack configs?</summary>
<p>Next.js tries its best to remove the overhead of webpack configurations, but for advanced cases where more control is needed, refer to the <a href="/docs/api-reference/next.config.js/custom-webpack-config.md">custom webpack config documentation</a>.</p>
<summary>Is Next.js production ready?</summary>
<p>Yes! Next.js is used by many of the top websites in the world. See the
<a href="https://nextjs.org/showcaseShowcase">Showcase</a> for more info.</p>
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
</details>

<details>
<summary>What syntactic features are compiled? How do I change them?</summary>
<p>We track V8. Since V8 has wide support for ES6 and async and await, we compile those. Since V8 doesn’t support class decorators, we don’t compile those.</p>

<p>See the documentation about <a href="/docs/advanced-features/customizing-babel-config.md">customizing babel config</a> for more information.</p>
<summary>How do I fetch data in Next.js?</summary>
Next.js provides a variety of methods depending on your use case. You can use:
<ul>
<li> Client-side rendering: Fetch data with <a href="/docs/basic-features/data-fetching/client-side#client-side-data-fetching-with-useeffect">useEffect</a> or <a href="/docs/basic-features/data-fetching/client-side#client-side-data-fetching-with-swr">SWR</a> inside your React components</li>
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
<li> Server-side rendering with <a href="/docs/basic-features/data-fetching/get-server-side-props">getServerSideProps</a></li>
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
<li> Static-site generation with <a href="/docs/basic-features/data-fetching/get-static-props">getStaticProps</a></li>
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
<li> Incremental Static Regeneration by <a href="/docs/basic-features/data-fetching/incremental-static-regeneration">adding the `revalidate` prop to getStaticProps</a></li>
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
</ul>
To learn more about data fetching, visit our <a href="/docs/basic-features/data-fetching/overview">data fetching documentation</a>.
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
</details>

<details>
<summary>Why a new Router?</summary>
<summary>Why does Next.js have its own Router?</summary>
Next.js is special in that:
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
<ul>
<li>Routes don’t need to be known ahead of time, We don't ship a route manifest</li>
<li>It uses a file-system based router which simplifies the app structure</li>
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
<li>It supports shallow routing which allows you to change the URL without running data fetching methods</li>
<li>Routes don’t need to be known ahead of time so we don't ship a route manifest</li>
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
<li>Routes are always lazy-loadable</li>
</ul>
If you're migrating from React Router, see the <a href="/docs/migrating/from-react-router">migration documentation</a>.
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
</details>

<details>
<summary>How do I fetch data?</summary>
<p>It's up to you. You can use the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch">fetch API</a> or <a href="https://swr.vercel.app/">SWR</a> inside your React components for remote data fetching; or use our <a href="/docs/basic-features/data-fetching/overview.md">data fetching methods</a> for initial data population.</p>
<summary>Can I use Next.js with my favorite JavaScript library?</summary>
<p>Yes! We have hundreds of examples of this in action in our <a href="https://github.com/vercel/next.js/tree/canary/examples">examples directory</a>.</p>
leerob marked this conversation as resolved.
Show resolved Hide resolved
</details>

<details>
<summary>Can I use it with GraphQL?</summary>
<p>Yes! Here's an <a href="https://github.com/vercel/next.js/tree/canary/examples/with-apollo">example with Apollo</a>.</p>
<summary>Can I use Next.js with GraphQL?</summary>
<p>Yes! Here's an <a href="https://github.com/vercel/next.js/tree/canary/examples/with-apollo">example with Apollo</a> and an <a href="https://github.com/vercel/next.js/tree/canary/examples/api-routes-graphql">example API route with GraphQL</a>.</p>
leerob marked this conversation as resolved.
Show resolved Hide resolved
</details>

<details>
<summary>Can I use it with Redux?</summary>
<p>Yes! Here's an <a href="https://github.com/vercel/next.js/tree/canary/examples/with-redux">example</a>. And there's another <a href="https://github.com/vercel/next.js/tree/canary/examples/with-redux-thunk">example with thunk</a>.</p>
<summary>Can I use Next.js with Redux?</summary>
<p>Yes! Here's an <a href="https://github.com/vercel/next.js/tree/canary/examples/with-redux">example with Redux</a> and an <a href="https://github.com/vercel/next.js/tree/canary/examples/with-redux-thunk">example with thunk</a>.</p>
</details>

<details>
<summary>Can I make a Next.js Progressive Web App (PWA)?</summary>
<p>Yes! Here's our <a href="https://github.com/vercel/next.js/tree/canary/examples/progressive-web-app">Next.js PWA Example</a>.</p>
</details>

<details>
<summary>Can I use a CDN for static assets?</summary>
<p>Yes. You can read more about it <a href="/docs/api-reference/next.config.js/cdn-support-with-asset-prefix.md">here</a>.</p>
<p>Yes! You can read more about how to do it <a href="/docs/api-reference/next.config.js/cdn-support-with-asset-prefix.md">here</a>.</p>
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
</details>

<details>
<summary>Can I use Next with my favorite JavaScript library or toolkit?</summary>
<p>Since our first release we've had many example contributions. You can check them out in the <a href="https://github.com/vercel/next.js/tree/canary/examples">examples</a> directory.</p>
<summary>How can I change the internal webpack configs?</summary>
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
<p>Next.js tries its best to remove the overhead of webpack configurations through supporting the most popular use cases. For advanced cases where more control is needed, refer to the <a href="/docs/api-reference/next.config.js/custom-webpack-config.md">custom webpack config documentation</a>.</p>
Nutlope marked this conversation as resolved.
Show resolved Hide resolved
</details>

<details>
<summary>What is this inspired by?</summary>
<summary>What is Next.js inspired by?</summary>
<p>Many of the goals we set out to accomplish were the ones listed in The <a href="https://rauchg.com/2014/7-principles-of-rich-web-applications">7 principles of Rich Web Applications</a> by Guillermo Rauch.</p>

<p>The ease-of-use of PHP is a great inspiration. We feel Next.js is a suitable replacement for many scenarios where you would otherwise use PHP to output HTML.</p>
Expand All @@ -72,8 +74,3 @@ description: Get to know more about Next.js with the frequently asked questions.

<p>As we were researching options for server-rendering React that didn’t involve a large number of steps, we came across <a href="https://github.com/facebookarchive/react-page">react-page</a> (now deprecated), a similar approach to Next.js by the creator of React Jordan Walke.</p>
</details>

<details>
<summary>Can I make a Next.js Progressive Web App (PWA)?</summary>
<p>Yes! Check out our <a href="https://github.com/vercel/next.js/tree/canary/examples/progressive-web-app">PWA Example</a> to see how it works.</p>
</details>