mirror of
https://github.com/hanzoai/vite.git
synced 2026-10-30 19:36:16 +00:00
13 lines
357 B
React
13 lines
357 B
React
import { createContext, useState } from 'react'
|
|
export const CountContext = createContext()
|
|
|
|
export const CountProvider = ({ children }) => {
|
|
const [count, setCount] = useState(0)
|
|
return (
|
|
<CountContext.Provider value={{ count, setCount }}>
|
|
{children}
|
|
<div id="context-provider">context provider</div>
|
|
</CountContext.Provider>
|
|
)
|
|
}
|