-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Charlie Brown <[email protected]> Co-authored-by: Kenan Yusuf <[email protected]>
- Loading branch information
1 parent
39416ec
commit a7e795a
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
id: 1 | ||
title: Server Side Rendering | ||
category: introduction | ||
type: docs | ||
scope: null | ||
--- | ||
|
||
# Server Side Rendering | ||
|
||
In frameworks such as Next.js 13+, context is fully supported within Client Components, but it cannot be created or consumed directly within Server Components. This is because Server Components have no React state (since they're not interactive), and context is primarily used for rerendering interactive components deep in the tree after some React state has been updated. | ||
Victory uses `createContext` to perform its operations and it must be rendered client side by adding the `use client` directive in your components when used in a framework with Server Side Component support. | ||
|
||
```jsx | ||
"use client"; | ||
import React from 'react'; | ||
import { VictoryBar, VictoryChart, VictoryTheme } from "victory"; | ||
|
||
const data = [ | ||
{ quarter: 1, earnings: 13000 }, | ||
{ quarter: 2, earnings: 16500 }, | ||
{ quarter: 3, earnings: 14250 }, | ||
{ quarter: 4, earnings: 19000 } | ||
]; | ||
|
||
const App = ()=>{ | ||
return ( | ||
<div style={styles.container}> | ||
<VictoryChart width={350} theme={VictoryTheme.material}> | ||
<VictoryBar data={data} x="quarter" y="earnings" /> | ||
</VictoryChart> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; | ||
``` |