Skip to main content

Extension

More

note

All files prefixed with an underscore (_) under the docs directory are treated as "partial" pages and will be ignored by default.

Customize Title

All files prefixed with an underscore (_) under the docs directory are treated as "partial" pages and will be ignored by default.

info

Check the for an exhaustive list of options.

tip

Tips

warning

Warning

danger

Danger

Markdown is declarative

Some content

Diagram

http://localhost:3000
Live Editor
function Clock(props) {
  const [date, setDate] = useState(new Date());
  useEffect(() => {
    const timerID = setInterval(() => tick(), 1000);

    return function cleanup() {
      clearInterval(timerID);
    };
  });

  function tick() {
    setDate(new Date());
  }

  return (
    <div>
      <h2>It is {date.toLocaleTimeString()}.</h2>
    </div>
  );
}
Result
Loading...

You can declare custom magic comments through theme config. For example, you can register another magic comment that adds a code-block-error-line class name:

export default {
themeConfig: {
prism: {
magicComments: [
// Remember to extend the default highlight class name as well!
{
className: 'theme-code-block-highlighted-line',
line: 'highlight-next-line',
block: {start: 'highlight-start', end: 'highlight-end'},
},
{
className: 'code-block-error-line',
line: 'This will error',
},
],
},
},
};