question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RaisedButton produces a refs error. Switching to FlatButton resolves the error.

See original GitHub issue

[x] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I’m attempting to add a RaisedButton to a registration form. I’ll add a link to my repo

      <RaisedButton 
        label="Submit" 
        primary={true} 
        style={style.button} 
        onClick={() => registerUser(username, password)}
      />

Current Behavior

This button produces an error: Element ref was specified as a string (container) but no owner was set. You may have multiple copies of React loaded. (details: https://fb.me/react-refs-must-have-owner).

When I replace the RaisedButton with a FlatButton, it works…

     <FlatButton 
        label="Submit" 
        primary={true} 
        style={style.button} 
        onClick={() => registerUser(username, password)}
      />

Steps to Reproduce (for bugs)

Replace FlatButton with RaisedButton in this file to see the error.

(I should add that I noticed after I pushed that material-ui was actually installed in my root directory, not directly in my client. Shouldn’t matter, but I installed it directly in my client anyway, and there was no change in the behavior.)

Context

I don’t have a lot of context beyond troubleshooting the project down to this one line (line 30 in Registration.js, linked above): replace the raised button with a flat button and it works again.

Your Environment

Tech Version
Material-UI 0.2
React 16.2
browser Chrome
etc

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
myaraskavitchcommented, Mar 2, 2018

I got the same error with the Getting Started instructions: http://www.material-ui.com/#/get-started/usage. Switching to FlatButton worked.

0reactions
oliviertassinaricommented, Mar 8, 2018

my team and I noticed the resulting code was quite verbose for two simple components

@patrickklima We try to make the components as close as possible to the HTML binding. Hopefully, it’s making people override story much simpler and allow third parties to build better abstractions on top of us.

after I noticed v1 was having some issues in those areas.

I’m glad the issue is fixed now, I will keep working hard on fixing all the reported issues.

or instance, in the project I linked, why are the two components in-line rather than stacked?

I’m not sure to understand. Maybe you are referring to the display property. Yes, the input elements are display: inline by default. You can use the fullWidth property to make them “stacked”. I’m also considering the option to add a block property to make them display: block.

Read more comments on GitHub >

github_iconTop Results From Across the Web

After upgrade Flutter 3.3.0 RaisedButton showing error
0 RaisedButton showing error: The method 'FlatButton' isn't defined for the type 'CartScreen'. (undefined_method - Stack Overflow. Stack ...
Read more >
Solution for “FlatButton/RaisedButton/OutlineButton ... - Medium
Problem: Running into “FlatButton/RaisedButton/OutlineButton is depreciated” error when running Flutter applications. Solution: As stated in the Flutter ...
Read more >
New Buttons and Button Themes - Flutter documentation
The FlatButton , RaisedButton and OutlineButton widgets have been replaced by TextButton , ElevatedButton , and OutlinedButton respectively.
Read more >
New Button Universe by HansMuller · Pull Request #59702
An app that uses TextButton and ContainedButton (nee FlatButton and RaisedButton) can configure the text color for all buttons by specifying a ...
Read more >
Angular Material Theming System - Complete Guide
We will see how to resolve SASS errors and what major changes are made in each release. Angular Material UI Components. Link to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found