This repository was archived by the owner on Jan 26, 2019. It is now read-only.
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
allowSyntheticDefaultImports flag in tsconfig.json #214
Closed
Description
In "Importing a Component" section in https://github.com/wmonk/create-react-app-typescript/blob/master/packages/react-scripts/template/README.md it says:
This project setup supports ES6 modules thanks to Babel.
While you can still use require() and module.exports, we encourage you to use import and export instead.For example:
Button.js
import React, { Component } from 'react';
class Button extends Component {
render() {
// ...
}
}
export default Button; // Don’t forget to use export default!
I had problems with this and had to use:
import * as React from 'react';
export default class Button extends React.Component {
//...
}
After some investigation I could use the first way using the flag allowSyntheticDefaultImports: true
in tsconfig.json
. I thought it could be useful for others to know it. Is it worth to make a pull request to add this to the README.md file?
Metadata
Metadata
Assignees
Labels
No labels