diff --git a/src/components/MDX/Sandpack/DownloadButton.tsx b/src/components/MDX/Sandpack/DownloadButton.tsx
index d6b1c329..94cf13dd 100644
--- a/src/components/MDX/Sandpack/DownloadButton.tsx
+++ b/src/components/MDX/Sandpack/DownloadButton.tsx
@@ -5,6 +5,7 @@
import {useSyncExternalStore} from 'react';
import {useSandpack} from '@codesandbox/sandpack-react/unstyled';
import {IconDownload} from '../../Icon/IconDownload';
+import {AppJSPath, StylesCSSPath, SUPPORTED_FILES} from './createFileMap';
export interface DownloadButtonProps {}
let supportsImportMap = false;
@@ -32,8 +33,6 @@ function useSupportsImportMap() {
return useSyncExternalStore(subscribe, getCurrentValue, getServerSnapshot);
}
-const SUPPORTED_FILES = ['/App.js', '/styles.css'];
-
export function DownloadButton({
providedFiles,
}: {
@@ -49,8 +48,8 @@ export function DownloadButton({
}
const downloadHTML = () => {
- const css = sandpack.files['/styles.css']?.code ?? '';
- const code = sandpack.files['/App.js']?.code ?? '';
+ const css = sandpack.files[StylesCSSPath]?.code ?? '';
+ const code = sandpack.files[AppJSPath]?.code ?? '';
const blob = new Blob([
`
diff --git a/src/components/MDX/Sandpack/SandpackRoot.tsx b/src/components/MDX/Sandpack/SandpackRoot.tsx
index df0c757f..d47fd903 100644
--- a/src/components/MDX/Sandpack/SandpackRoot.tsx
+++ b/src/components/MDX/Sandpack/SandpackRoot.tsx
@@ -9,6 +9,7 @@ import {SandpackLogLevel} from '@codesandbox/sandpack-client';
import {CustomPreset} from './CustomPreset';
import {createFileMap} from './createFileMap';
import {CustomTheme} from './Themes';
+import {template} from './template';
type SandpackProps = {
children: React.ReactNode;
@@ -70,17 +71,19 @@ function SandpackRoot(props: SandpackProps) {
const codeSnippets = Children.toArray(children) as React.ReactElement[];
const files = createFileMap(codeSnippets);
- files['/styles.css'] = {
- code: [sandboxStyle, files['/styles.css']?.code ?? ''].join('\n\n'),
- hidden: !files['/styles.css']?.visible,
+ files['/src/styles.css'] = {
+ code: [sandboxStyle, files['/src/styles.css']?.code ?? ''].join('\n\n'),
+ hidden: !files['/src/styles.css']?.visible,
};
return (
{
return codeSnippets.reduce(
(result: Record, codeSnippet: React.ReactElement) => {
@@ -26,15 +30,16 @@ export const createFileMap = (codeSnippets: any) => {
}
} else {
if (props.className === 'language-js') {
- filePath = '/App.js';
+ filePath = AppJSPath;
} else if (props.className === 'language-css') {
- filePath = '/styles.css';
+ filePath = StylesCSSPath;
} else {
throw new Error(
`Code block is missing a filename: ${props.children}`
);
}
}
+
if (result[filePath]) {
throw new Error(
`File ${filePath} was defined multiple times. Each file snippet should have a unique path name`
diff --git a/src/components/MDX/Sandpack/index.tsx b/src/components/MDX/Sandpack/index.tsx
index 6873547a..6755ba8d 100644
--- a/src/components/MDX/Sandpack/index.tsx
+++ b/src/components/MDX/Sandpack/index.tsx
@@ -3,7 +3,7 @@
*/
import {lazy, memo, Children, Suspense} from 'react';
-import {createFileMap} from './createFileMap';
+import {AppJSPath, createFileMap} from './createFileMap';
const SandpackRoot = lazy(() => import('./SandpackRoot'));
@@ -57,7 +57,7 @@ export default memo(function SandpackWrapper(props: any): any {
);
let activeCode;
if (!activeCodeSnippet.length) {
- activeCode = codeSnippet['/App.js'].code;
+ activeCode = codeSnippet[AppJSPath].code;
} else {
activeCode = codeSnippet[activeCodeSnippet[0]].code;
}
diff --git a/src/components/MDX/Sandpack/template.ts b/src/components/MDX/Sandpack/template.ts
new file mode 100644
index 00000000..9ead18a1
--- /dev/null
+++ b/src/components/MDX/Sandpack/template.ts
@@ -0,0 +1,54 @@
+export const template = {
+ '/src/index.js': {
+ hidden: true,
+ code: `import React, { StrictMode } from "react";
+import { createRoot } from "react-dom/client";
+import "./styles.css";
+
+import App from "./App";
+
+const root = createRoot(document.getElementById("root"));
+root.render(
+
+
+
+);`,
+ },
+ '/package.json': {
+ hidden: true,
+ code: JSON.stringify(
+ {
+ name: 'react.dev',
+ version: '0.0.0',
+ main: '/src/index.js',
+ scripts: {
+ start: 'react-scripts start',
+ build: 'react-scripts build',
+ test: 'react-scripts test --env=jsdom',
+ eject: 'react-scripts eject',
+ },
+ dependencies: {
+ react: '^18.0.0',
+ 'react-dom': '^18.0.0',
+ 'react-scripts': '^5.0.0',
+ },
+ },
+ null,
+ 2
+ ),
+ },
+ '/public/index.html': {
+ hidden: true,
+ code: `
+
+
+
+
+ Document
+
+
+
+
+`,
+ },
+};
diff --git a/src/content/blog/2023/03/16/introducing-react-dev.md b/src/content/blog/2023/03/16/introducing-react-dev.md
index d2e11fde..4ce209d7 100644
--- a/src/content/blog/2023/03/16/introducing-react-dev.md
+++ b/src/content/blog/2023/03/16/introducing-react-dev.md
@@ -57,7 +57,7 @@ If you like to learn by doing, we recommend checking out the [Tic-Tac-Toe Tutori
-```js App.js
+```js src/App.js
import { useState } from 'react';
function Square({ value, onSquareClick }) {
@@ -175,7 +175,7 @@ function calculateWinner(squares) {
}
```
-```css styles.css
+```css src/styles.css
* {
box-sizing: border-box;
}
diff --git a/src/content/community/conferences.md b/src/content/community/conferences.md
index b49425b8..efeb0138 100644
--- a/src/content/community/conferences.md
+++ b/src/content/community/conferences.md
@@ -10,6 +10,7 @@ Do you know of a local React.js conference? Add it here! (Please keep the list c
## Upcoming Conferences {/*upcoming-conferences*/}
+<<<<<<< HEAD
### RedwoodJS Conference 2023 {/*redwoodjs-conference-2023*/}
September 26 - 29, 2023. Grants Pass, Oregon + remote (hybrid event)
@@ -66,6 +67,8 @@ December 8 & 12, 2023. In-person in Berlin, Germany + remote first interactivity
[Website](https://reactday.berlin) - [Twitter](https://twitter.com/reactdayberlin) - [Facebook](https://www.facebook.com/reactdayberlin/) - [Videos](https://portal.gitnation.org/events/react-day-berlin-2023)
+=======
+>>>>>>> 303ecae3dd4c7b570cf18e0115b94188f6aad5a1
### App.js Conf 2024 {/*appjs-conf-2024*/}
May 22 - 24, 2024. In-person in Kraków, Poland + remote
@@ -76,8 +79,68 @@ June 12 - June 14, 2024. Atlanta, GA, USA
[Website](https://renderatl.com) - [Discord](https://www.renderatl.com/discord) - [Twitter](https://twitter.com/renderATL) - [Instagram](https://www.instagram.com/renderatl/) - [Facebook](https://www.facebook.com/renderatl/) - [LinkedIn](https://www.linkedin.com/company/renderatl) - [Podcast](https://www.renderatl.com/culture-and-code#/)
+### React India 2024 {/*react-india-2024*/}
+October 17 - 19, 2024. In-person in Goa, India (hybrid event) + Oct 15 2024 - remote day
+
+[Website](https://www.reactindia.io) - [Twitter](https://twitter.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia) - [Youtube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w)
+
## Past Conferences {/*past-conferences*/}
+### React Day Berlin 2023 {/*react-day-berlin-2023*/}
+December 8 & 12, 2023. In-person in Berlin, Germany + remote first interactivity (hybrid event)
+
+[Website](https://reactday.berlin) - [Twitter](https://twitter.com/reactdayberlin) - [Facebook](https://www.facebook.com/reactdayberlin/) - [Videos](https://portal.gitnation.org/events/react-day-berlin-2023)
+
+### React Summit US 2023 {/*react-summit-us-2023*/}
+November 13 & 15, 2023. In-person in New York, US + remote first interactivity (hybrid event)
+
+[Website](https://reactsummit.us) - [Twitter](https://twitter.com/reactsummit) - [Facebook](https://www.facebook.com/reactamsterdam) - [Videos](https://portal.gitnation.org/events/react-summit-us-2023)
+
+### reactjsday 2023 {/*reactjsday-2023*/}
+October 27th 2023. In-person in Verona, Italy and online (hybrid event)
+
+[Website](https://2023.reactjsday.it/) - [Twitter](https://twitter.com/reactjsday) - [Facebook](https://www.facebook.com/GrUSP/) - [YouTube](https://www.youtube.com/c/grusp)
+
+### React Advanced 2023 {/*react-advanced-2023*/}
+October 20 & 23, 2023. In-person in London, UK + remote first interactivity (hybrid event)
+
+[Website](https://www.reactadvanced.com/) - [Twitter](https://twitter.com/ReactAdvanced) - [Facebook](https://www.facebook.com/ReactAdvanced) - [Videos](https://portal.gitnation.org/events/react-advanced-conference-2023)
+
+### React Brussels 2023 {/*react-brussels-2023*/}
+October 13th 2023. In-person in Brussels, Belgium + Remote (hybrid)
+
+[Website](https://www.react.brussels/) - [Twitter](https://twitter.com/BrusselsReact)
+
+### React India 2023 {/*react-india-2023*/}
+October 5 - 7, 2023. In-person in Goa, India (hybrid event) + Oct 3 2023 - remote day
+
+[Website](https://www.reactindia.io) - [Twitter](https://x.com/react_india) - [Facebook](https://www.facebook.com/ReactJSIndia) - [Youtube](https://www.youtube.com/channel/UCaFbHCBkPvVv1bWs_jwYt3w)
+
+### RenderCon Kenya 2023 {/*rendercon-kenya-2023*/}
+September 29 - 30, 2023. Nairobi, Kenya
+
+[Website](https://rendercon.org/) - [Twitter](https://twitter.com/renderconke) - [LinkedIn](https://www.linkedin.com/company/renderconke/) - [YouTube](https://www.youtube.com/channel/UC0bCcG8gHUL4njDOpQGcMIA)
+
+### React Live 2023 {/*react-live-2023*/}
+September 29, 2023. Amsterdam, Netherlands
+
+[Website](https://reactlive.nl/)
+
+### React Alicante 2023 {/*react-alicante-2023*/}
+September 28 - 30, 2023. Alicante, Spain
+
+[Website](https://reactalicante.es/) - [Twitter](https://twitter.com/reactalicante)
+
+### RedwoodJS Conference 2023 {/*redwoodjs-conference-2023*/}
+September 26 - 29, 2023. Grants Pass, Oregon + remote (hybrid event)
+
+[Website](https://www.redwoodjsconf.com/) - [Twitter](https://twitter.com/redwoodjs)
+
+### React Native EU 2023 {/*react-native-eu-2023*/}
+September 7 & 8, 2023. Wrocław, Poland
+
+[Website](https://react-native.eu) - [Twitter](https://twitter.com/react_native_eu) - [Facebook](https://www.facebook.com/reactnativeeu)
+
### React Rally 2023 🐙 {/*react-rally-2023*/}
August 17 & 18, 2023. Salt Lake City, UT, USA
diff --git a/src/content/community/meetups.md b/src/content/community/meetups.md
index 644bbcee..000eeb43 100644
--- a/src/content/community/meetups.md
+++ b/src/content/community/meetups.md
@@ -101,6 +101,7 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet
* [Bangalore (React Native)](https://www.meetup.com/React-Native-Bangalore-Meetup)
* [Chennai](https://www.meetup.com/React-Chennai/)
* [Delhi NCR](https://www.meetup.com/React-Delhi-NCR/)
+* [Mumbai](https://reactmumbai.dev)
* [Pune](https://www.meetup.com/ReactJS-and-Friends/)
## Indonesia {/*indonesia*/}
diff --git a/src/content/learn/add-react-to-an-existing-project.md b/src/content/learn/add-react-to-an-existing-project.md
index aa7918f0..f7b78006 100644
--- a/src/content/learn/add-react-to-an-existing-project.md
+++ b/src/content/learn/add-react-to-an-existing-project.md
@@ -67,7 +67,7 @@ Onda dodajte ove linije koda na vrh vašeg glavnog JavaScript fajla (možda se z
```
-```js index.js active
+```js src/index.js active
import { createRoot } from 'react-dom/client';
// Clear the existing HTML content
@@ -133,7 +133,7 @@ Ovo vam omogućava da pronađete taj HTML element sa [`document.getElementById`]