Skip to content
Dashboard

Next.js 4: React 16 and styled-jsx 2

Link to headingReact 16

npm i next@latest react@latest react-dom@latest

A benchmark of 5000 requests against Next.js 3.0 SSR
A benchmark of 5000 requests against Next.js 3.0 SSR
A benchmark of 5000 requests against Next.js 4 SSR. 2.6x faster!
A benchmark of 5000 requests against Next.js 4 SSR. 2.6x faster!

Link to headingStyled-jsx 2

export default () => (
<div>
Hello there <span>my friend</span>
<style jsx>{`
/* this style only applies to the span within lexical scope */
span { color: red; }
`}</style>
</div>
)

CSS can be embedded alongside your JSX. It just works!

import { COLOR } from './css-config';
export default () => (
<div>
Hello there <span>my friend</span>
<style jsx>{`
/* this style only applies to the span within lexical scope */
span { color: ${COLOR}; }
`}</style>
</div>
)

In this case, COLOR is a constant, which is supported in 1.x

export default ({ color }) => (
<div>
Hello there <span>my friend</span>
<style jsx>{`
/* this style only applies to the span within lexical scope */
span { color: ${color}; }
`}</style>
</div>
)

In this case, color is a React prop and can change over time!

Link to headingFull Release Notes

Link to headingConclusion