Tutorial Intro
Let's discover Docusaurus in less than 5 minutes.
Getting Started
Docusaurus v3 defaults(/rise4fun-config)
rise4fun plugins for v3
function HighlightSomeText(highlight) {
if (highlight) {
return 'This text is highlighted!';
}
return 'Nothing highlighted';
}
function HighlightMoreText(highlight) {
if (highlight) {
return 'This range is highlighted!';
}
return 'Nothing highlighted';
}
import React from 'react';
function MyComponent(props) {
if (props.isBar) {
return <div>Bar</div>;
}
return <div>Foo</div>;
}
export default MyComponent;
function HighlightSomeText(highlight) {
if (highlight) {
console.log('Highlighted text found');
return 'This text is highlighted!';
}
return 'Nothing highlighted';
}
In JavaScript, trying to access properties on null will error.
const name = null;
console.log(name.toUpperCase());
// Uncaught TypeError: Cannot read properties of null (reading 'toUpperCase')
import React from 'react';
export default function MyComponent(props) {
return <div>Foo</div>;
}
export default function MyComponent(props) {
return <div>Foo</div>;
}
live
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...
Live Editor
const project = 'Docusaurus'; const Greeting = () => <p>Hello {project}!</p>; render(<Greeting />);
Result
Loading...
Live Editor
const project = 'Docusaurus'; const Greeting = () => <p>Hello {project}!</p>; render(<Greeting />);
Result
Loading...