Skip to content

Instantly share code, notes, and snippets.

View ernestofreyreg's full-sized avatar
🚢
Just ship it

Ernesto Freyre ernestofreyreg

🚢
Just ship it
View GitHub Profile
import * as React from 'react'
interface Props {}
const MyComponent: React.FunctionComponent<Props> = () => (
<div role='heading'>My First Component</div>
)
export default MyComponent
import MyComponent from './components/MyComponent'
export { MyComponent }
import * as React from 'react'
import { render } from '@testing-library/react'
import '@testing-library/jest-dom/extend-expect'
import { MyComponent } from '../../index'
test('Renders', async () => {
const { getByRole } = render(<MyComponent />)
expect(getByRole('heading')).toHaveTextContent('My First Component')
})
import { configure } from '@storybook/react'
configure(require.context('../src', true, /\.stories\.tsx$/), module)
const path = require('path')
const SRC_PATH = path.join(__dirname, '../src')
module.exports = ({ config }) => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
include: [SRC_PATH],
use: [
{
loader: require.resolve('awesome-typescript-loader'),
import * as React from 'react'
import MyComponent from './MyComponent'
export default { title: 'MyComponent' }
export const basic = () => <MyComponent />
import * as React from 'react'
import { NextPage } from 'next'
interface Props {}
const Page: NextPage<Props> = () => (
<div>Initial Page</div>
)
export default Page
import * as React from 'react'
import { NextPage } from 'next'
interface Props {}
const DashboardPage: NextPage<Props> = () => (
<div>Dashboard</div>
)
export default DashboardPage
import * as React from 'react'
import createAuth0Client from '@auth0/auth0-spa-js'
import { useRouter } from 'next/router'
import { NextPage } from 'next'
const DEFAULT_REDIRECT_CALLBACK = () =>
window.history.replaceState({}, document.title, window.location.pathname)
interface Auth0ProviderProps {
children: React.ReactNode
import * as React from 'react'
import App from 'next/app'
import Head from 'next/head'
import { Auth0Provider } from '../lib/auth0-spa'
export default class MyApp extends App {
render () {
const { Component, pageProps, router } = this.props
const onRedirectCallback = appState => {