Skip to content

Instantly share code, notes, and snippets.

import React from 'react';
import axios from 'axios';
import './App.css';
const SWAPI_URL = 'https://swapi.co/api';
const FilmSelector = ({ options, onChange }) => (
<select onChange={onChange}>
<option value="">Select</option>
{
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
import React from 'react'
import { shallow } from 'enzyme'
import App from './App'
describe('App', () => {
it('renders without crashing', () => {
const wrapper = shallow(<App />);
expect(wrapper).toBeTruthy();
})
var enzyme = require('enzyme');
var Adapter = require('enzyme-adapter-react-16');
enzyme.configure({ adapter: new Adapter() });
{
"roots": [
"<rootDir>/src"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"setupFilesAfterEnv": ["<rootDir>/setupEnzyme.js"],
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
"moduleNameMapper": {
declare module '*.css'
declare module '*.scss'
declare module '*.html'
declare module '*.png'
declare module '*.jpg'
declare module '*.svg'
import React from 'react'
import './App.scss'
const App:React.StatelessComponent<{}> = () => (
<div className='container'>
<h1>Hello World, React!</h1>
</div>
)
...
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
...
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es6",
"jsx": "react",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
...
{
test: /\.(png|svg|jpg|gif)$/,
use: [
'file-loader'
]
}
...