mycomponents_mock_mocksson
v1.0.2
Published
``` create-react-library mycomponents (npm and typescript as options)
Downloads
9
Readme
mycomponents
create-react-library mycomponents (npm and typescript as options)
npx -p @storybook/cli sb init --type react_scripts
npm install -D babel-loader @babel/core @babel/preset-env webpack
npm install @babel/preset-react"
npm install @babel/preset-typescript"
npm install react-docgen-typescript-loader
(https://github.com/Luchanso/storybook-typescript-problem)
and webpack.config.js should be:
module.exports = ({ config }) => {
config.module.rules.push({
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: require.resolve("babel-loader"),
options: {
presets: [
require("@babel/preset-typescript").default,
require("@babel/preset-react").default
]
}
},
require.resolve("react-docgen-typescript-loader")
]
});
config.resolve.extensions.push(".ts", ".tsx");
return config;
};
Install
npm install --save mycomponents
Usage
import * as React from 'react'
import MyComponent from 'mycomponents'
class Example extends React.Component {
render () {
return (
<MyComponent />
)
}
}
License
MIT © programinho