This repository houses react examples which are uploaded to The Odin Project's CodeSandbox account. Ultimately, these examples appear as CodeSandbox embeds in The Odin Project's React Curriculum .
- Read through the contributing guide.
- Make sure you have node, npm and npx installed. You may use the Installing Node.js lesson to install these tools.
- Fork & clone this repository. Install dependencies by running
npm install
. - Create a new example folder by copying the
boilerplate
folder. Andcd
into it and install dependencies.cp -R ./boilerplate ./<example-name> cd ./<example-name> npm install
- Code out your example.
- Start the dev server
npm run start
to make sure the example runs as expected. - Run
npm run lint
for ESLint and Prettier to format the code. - Create the pull request. (remember to mention which lesson will require the example)
Make sure that examples are clearly named, meaning they should convey what the example is about on a glance. Examples:
// bad
example-1
state-example
arrays
// good
hello-world
passing-props
rendering-arrays-in-jsx
- Login to the organisation's CodeSandbox account.
- Head over to CodeSandbox's GitHub import wizard.
- Insert example link to the "URL to GitHub" field.
- This link will be a subdirectory of this repository. For example, to generate a sandbox for the
boilerplate
example, use https://github.com/TheOdinProject/react-examples/tree/main/boilerplate.
- This link will be a subdirectory of this repository. For example, to generate a sandbox for the
- Click the "Open Sandbox" button to generate the sandbox.
- After the sandbox is live, click "Share", then "Copy Embed Code". This code will be placed in our markdown files where needed.
Note: Embed options need to be explored.