私はいくつかのコンポーネントを追加したストーリーブックでプロジェクトを作成しました。 私はエラーstorybookからコンポーネントを使用するとaddComponentAsRefToエラーが発生する
Uncaught Error: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's
render
method, or you have multiple copies of React loaded.
を取得し、別のプロジェクトでは、これらのコンポーネントを使用しようとすると
"build": "babel components --out-dir dist-es6 --source-maps inline",
私.babelrcはこのようになりますように私は絵本を築く:私はエクスポート
{
"presets": [
"es2015", // whichever presets your projects use should match here
"stage-0",
"react"
],
"plugins": [
"transform-runtime", // for polyfills
"transform-react-remove-prop-types" // we use this to remove the propTypes
]}
私のコンポーネントは次のようなindex.jsファイルを持っています:
export { default as DateFilter } from './DateFilter';
私は、コンポーネントが含まれます:
import { DateFilter } from 'storybook/dist-es6';
私は私のプロジェクトでそれを使用するために童話中のNMPのリンクを行います。私はコンポーネントを見ることができますが、それはキャッチされていないエラーで失敗します。
どうすればよいですか?