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
import { Suspense, lazy, memo, Children } from 'react'; | |
import { createFileMap } from './createFileMap'; | |
const SandpackRoot = lazy(() => import('./SandpackRoot')); | |
type PlaygroundProps = { | |
children: React.ReactNode; | |
}; |
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
import type { SandpackFile } from '@codesandbox/sandpack-react'; | |
export const createFileMap = (codeSnippets: React.ReactElement[]) => { | |
return codeSnippets.reduce( | |
(result: Record<string, SandpackFile>, codeSnippet: React.ReactElement) => { | |
if (codeSnippet.type !== 'pre') { | |
return result; | |
} | |
const { props } = codeSnippet.props.children; |
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
import React from 'react'; | |
const teachers = [ | |
{ id: 1, name: 'Abhishek', subject: 'React' }, | |
{ id: 2, name: 'Aakash', subject: 'JavaScript' } | |
] | |
const Description = () => ( | |
<dl> | |
{ |
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
import React from 'react'; | |
const TableColumns = (props) => { | |
const { name, subject } = props; | |
return ( | |
<div> | |
<td>{name}</td> | |
<td>{subject}</td> | |
</div> |
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
import React from 'react'; | |
const TableColumns = (props) => { | |
const { name, subject } = props; | |
return ( | |
<React.Fragment> | |
<td>{name}</td> | |
<td>{subject}</td> | |
</React.Fragment> |
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
import React from 'react'; | |
import TableColumns from './TableColumns'; | |
const teachers = [ | |
{ id: 1, name: 'Abhishek', subject: 'React' }, | |
{ id: 2, name: 'Aakash', subject: 'JavaScript' } | |
] | |
const Table = () => ( |
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
@import url('https://fonts.googleapis.com/css?family=Quicksand:400,500,700'); | |
/* Basic */ | |
*, | |
*::after, | |
*:before { | |
margin: 0; | |
padding: 0; | |
box-sizing: inherit; |
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
import React from 'react'; | |
const Spinner = () => ( | |
<div className="spinner"> | |
<div className="bounce1"></div> | |
<div className="bounce2"></div> | |
<div className="bounce3"></div> | |
</div> | |
); |
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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './index.css'; | |
import App from './App'; | |
ReactDOM.render(<App />, document.getElementById('root')); |
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
updateMocktail = mocktail => { | |
const newMocktail = mocktail; | |
this.setState(state => { | |
if (state.mocktail === newMocktail) { | |
return null; | |
} else { | |
return { mocktail }; | |
} | |
}) | |
} |
NewerOlder