Skip to content
This repository has been archived by the owner on Feb 15, 2021. It is now read-only.

Latest commit

 

History

History
51 lines (43 loc) · 1.01 KB

PropTypes.md

File metadata and controls

51 lines (43 loc) · 1.01 KB

ComponentSheet also supports an optional jsx pragma, which suppresses PropType warnings for component declarations inside ComponentSheet.create, while enabling them for the resultant jsx returned during rendering.

You can add it with either:

// @jsx ComponentSheet.createElement

or with @babel/transform-react-jsx:

// babel.config.js
module.exports = {
  plugins: [
    [
      '@babel/transform-react-jsx',
      {
        pragma: 'ComponentSheet.createElement',
      }
    ],
  ],
};

or with [babel-plugin-import-jsx-pragma][babel-plugin-import-jsx-pragma]:

// babel.config.js
module.exports = {
  plugins: [
    [
      '@wordpress/babel-plugin-import-jsx-pragma',
      {
        scopeVariable: 'ComponentSheet_createElement',
        source: '@component-sheet/native', // or @component-sheet/aphrodite, etc.
        isDefault: false,
      }
    ],
    [
      '@babel/transform-react-jsx',
      {
        pragma: 'ComponentSheet_createElement',
      }
    ],
  ],
};