Skip to content

Commit

Permalink
docs: enable strict mode in react examples (#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
Balastrong authored Jun 27, 2024
1 parent 3596874 commit adc74e0
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 10 deletions.
6 changes: 5 additions & 1 deletion examples/react/array/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ function App() {

const rootElement = document.getElementById('root')!

createRoot(rootElement).render(<App />)
createRoot(rootElement).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
4 changes: 3 additions & 1 deletion examples/react/next-server-actions/next.config.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
const nextConfig = {
reactStrictMode: true,
}

module.exports = nextConfig
8 changes: 5 additions & 3 deletions examples/react/query-integration/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ const rootElement = document.getElementById('root')!
const queryClient = new QueryClient()

createRoot(rootElement).render(
<QueryClientProvider client={queryClient}>
<App />
</QueryClientProvider>,
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<App />
</QueryClientProvider>
</React.StrictMode>,
)
6 changes: 5 additions & 1 deletion examples/react/simple/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,8 @@ export default function App() {

const rootElement = document.getElementById('root')!

createRoot(rootElement).render(<App />)
createRoot(rootElement).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
8 changes: 7 additions & 1 deletion examples/react/ui-libraries/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { red } from '@mui/material/colors'
import { ThemeProvider } from '@emotion/react'
import { CssBaseline } from '@mui/material'
import MainComponent from './MainComponent'
import React from 'react'

const theme = createTheme({
palette: {
primary: {
Expand All @@ -29,4 +31,8 @@ export default function App() {

const rootElement = document.getElementById('root')!

createRoot(rootElement).render(<App />)
createRoot(rootElement).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
6 changes: 5 additions & 1 deletion examples/react/valibot/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,8 @@ export default function App() {

const rootElement = document.getElementById('root')!

createRoot(rootElement).render(<App />)
createRoot(rootElement).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
6 changes: 5 additions & 1 deletion examples/react/yup/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,8 @@ export default function App() {

const rootElement = document.getElementById('root')!

createRoot(rootElement).render(<App />)
createRoot(rootElement).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
6 changes: 5 additions & 1 deletion examples/react/zod/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,8 @@ export default function App() {

const rootElement = document.getElementById('root')!

createRoot(rootElement).render(<App />)
createRoot(rootElement).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)

0 comments on commit adc74e0

Please sign in to comment.