Error with Stateless Components
See original GitHub issueHas anyone else had an issue with getting stateless functional components to load?
I am getting this error:
Error when parsing src/scripts/components/Inputs/Button.jsx RangeError: Maximum call stack size exceeded
This my styleguide.config,js
/* global module, require, process, __dirname */
const path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
const docgen = require('react-docgen');
module.exports = {
title: 'Components',
defaultExample: true,
serverPort: 5000,
showCode: true,
skipComponentsWithoutExample: true,
getExampleFilename: componentpath => componentpath.replace(/\.jsx$/, '.examples.md'),
resolver: docgen.resolver.findAllComponentDefinitions,
sections: [
{
name: 'Inputs',
components: './src/scripts/components/Inputs/**/*.jsx',
},
{
name: 'Navigation',
components: './src/scripts/components/NavBar/**/*.jsx',
},
{
name: 'Layout',
components: './src/scripts/components/layout/**/*.jsx',
},
],
updateWebpackConfig: function(webpackConfig, env) {
const dir = path.join(__dirname, 'src');
webpackConfig.module.loaders.push(
{
test: /\.jsx?$/,
exclude: /node_modules/,
include: path.join(__dirname, 'src'),
loader: 'babel'
},
{
test: /\.css$/,
include: dir,
loader: 'style!css?modules&importLoaders=1'
},
{
test: /\.scss$/,
include: path.join(__dirname, 'src'),
loader: ExtractTextPlugin.extract(
'style-loader',
'css-loader?' +
'modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]' +
'!sass')
},
{
test: /\.less$/,
exclude: /node_modules/,
loader: 'style!css!less'
},
{
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/,
include: path.join(__dirname, 'src'),
loader: 'url?limit=8192'
}
);
webpackConfig.plugins.push(
new ExtractTextPlugin('css/app.css')
);
return webpackConfig;
}
};
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:16 (2 by maintainers)
Top Results From Across the Web
Stateless component in react with typescript error 'Type ...
I'm trying to build a stateless component in react with typescript, I have a long error message that ends by Type 'ObjectType[string]' is ......
Read more >React 16: Stateless function components cannot be given refs ...
I'm having this issue when using redux, which wraps another wrapper: DragDropContext(HTML5Backend)(connect(mapStateToProps, mapDispatchToProps, ...
Read more >Stateless Component - Cloud Computing Patterns
Stateless Component. State is handled external of application components to ease their ... In case of failure, this information may even be lost....
Read more >Handle errors in React components like a pro
In order to use Error Boundary in Functional Component, I use react-error-boundary. import * as React from 'react' import ...
Read more >How I write React stateless functional components - moox.io
This problem is basically not related to React component but more “how do you define your arguments in functions”. I will stick to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Well, in setting up a pared down example for you, @n1313, I discovered what was causing this issue in my project.
It turns out our project was also depending on
react-docgen
and was using it into ourstyleguidist.config.js
Removing the
resolver
key from thismodule.export
fixes the problem, and my components appear to work better.Cheers, and thanks!
Edit!
Instead of just removing the resolver (because we need it), updating
react-docgen
to3.0.0-beta9
(which is currently used by react-styleguidist) also fixed this issue.Just removing react-docgen didn’t work for me. But ;
downgrading styleguidist from v9 to ^8.0.6 AND removing react-docgen from package.json solved the problem for me.