daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Mar 14th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. ```
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top