Guest User

Untitled

a guest
Mar 14th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. При написании компонента необходимо добавить его реэкспорт в `index.ts` родительской директории:
  2. ```typescript
  3. // src/components/YourComponent/YourComponent.tsx
  4. export interface YourComponentProps {}
  5. export default class YourComponent extends React.PureComponent<YourComponentProps>
  6.  
  7.  
  8. // src/components/index.ts
  9. // ...other reexports
  10. export { default as YourComponent, YourComponentProps } from './YourComponent/YourComponent';
  11. ```
  12.  
  13. Это позволит писать так
  14. ```diff
  15. - import YourComponent from 'components/YourComponent/YourComponent';
  16. - import AnotherComponent from 'components/AnotherComponent/AnotherComponent';
  17. + import { YourComponent, AnotherComponent } from 'components';
  18. ```
Add Comment
Please, Sign In to add comment