Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with libraries #119

Closed
nsantini opened this issue Oct 27, 2016 · 22 comments
Closed

Issues with libraries #119

nsantini opened this issue Oct 27, 2016 · 22 comments

Comments

@nsantini
Copy link

Im using material-ui to create my components, every time I click on something like a menu or a radio button that is supposed to change the view somehow I get:
Uncaught Error: addComponentAsRefTo(...): Only a ReactOwner can have refs.

I wonder if this is a conflict with this particular library or if other react libraries suffer the same with nextjs.

@ugiacoman
Copy link

@nsantini Any luck integrating Material-UI? I am facing a Maximum call stack size exceeded error when implementing a RaisedButton component.

@nsantini
Copy link
Author

Haven't been able to make it work with material-ui, I have been able to make it work with react-bootstrap though.

@ugiacoman
Copy link

I got slightly further with react-toolbox, but without webpack to load the SASS, it won't work. One idea would be to convert all the SASS into CSS and then insert them into the page via <HEAD>. Haven't tried it though.

@mattapperson
Copy link

Ran into this issue as well with material-ui... confused as to what the source might be though

@frol
Copy link
Contributor

frol commented Nov 4, 2016

Has anybody succeeded with any of the existing UI toolkit using Next.js?

@frol
Copy link
Contributor

frol commented Nov 5, 2016

FYI, I have just reported an issue, which seems to reveal the root cause of the issue we encounter in most of the UI toolkits: #204. Please, have a look and maybe you will have a good guess of how this can be fixed.

@frol
Copy link
Contributor

frol commented Nov 7, 2016

I have succeeded in hacking Next.js to work with React-MD in #221, and it can be also hacked to work with Material-UI, but I have no idea on how to solve the hacks as I have a very little experience with NodeJS world. Thus, I put all my findings into the comments to the PR. I hope somebody will make sense out of my proof of concept and implement a proper PR.

@jonaswindey
Copy link
Contributor

@nsantini how did you manage to get react-bootstrap working?

@mattapperson
Copy link

@jonaswindey for me, it just worked... what sees to be your issue?

@jonaswindey
Copy link
Contributor

jonaswindey commented Nov 15, 2016

Nevermind, apparently you have to manually load the bootstrap from a CDN

@mattapperson
Copy link

@jonaswindey did you add the css from react-bootstrap?

@nsantini
Copy link
Author

@jonaswindey you got it, boostrap is different than matarial-ui in that css is separate and uses className to apply styles, material-ui uses inline styling applied to the components

@rauchg
Copy link
Member

rauchg commented Nov 17, 2016

In general I recommend you load the CSS through <Head> (more on this technique here: https://github.com/zeit/next.js/wiki/Global-styles-and-layouts), but as you can probably guess, the strength of Next.js is in using libraries that already bundle the CSS intelligently.

The reason for this is obvious: why ship more CSS than is actually needed? eg: why ship an entire stylesheet of tools, inputs, textareas, radio buttons if you're only going to use a dropdown menu in a certain page?

For an example of this mindset check out http://jxnblk.com/rebass/ by @jxnblk

Rebass is a React UI component library that uses inline styles to avoid CSS dependencies and prevent leaky global styles from affecting an application. Rebass components inherit styles where appropriate and can be customized using React Context. Rebass components are built as stateless functional components and modeled as presentational components

@rauchg
Copy link
Member

rauchg commented Nov 17, 2016

That said, our goal is to make the framework work with everything that works with React. For that we're exposing the webpack / babel config you can extend. The method we're going with is: #222

@timneutkens
Copy link
Member

Custom webpack config is now supported: https://github.com/zeit/next.js#customizing-webpack-config
@nsantini is this still an active issue? Otherwise it can be closed ❤️

@timneutkens
Copy link
Member

Closing in favor of custom webpack config. If your issue is not solved. Please do re-open this one. Or create a new one 👍

@cyrus-za
Copy link

@timneutkens I am not sure what to do with my custom webpack config to fix this issue. #232

@vozni4iy
Copy link

@cyrus-za do you manage to solve the issue with injectTapEventPlugin?

@vozni4iy
Copy link

var reactDomLibPath = path.join(__dirname, "./node_modules/react-dom/lib");
var alias = {};
["EventPluginHub", "EventConstants", "EventPluginUtils", "EventPropagators",
 "SyntheticUIEvent", "CSSPropertyOperations", "ViewportMetrics"].forEach(function(filename){
    alias["react/lib/"+filename] = path.join(__dirname, "./node_modules/react-dom/lib", filename);
});

config.resolve = {
      alias: alias
    }

This helps

@cyrus-za
Copy link

Thanks @vozni4iy that helps

@sunlee-newyork
Copy link

+1
Getting RangeError: Maximum call stack size exceeded on RaisedButton for the following line:
var styles = getStyles(this.props, this.context, this.state); // 298

@lock
Copy link

lock bot commented May 10, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

12 participants