React - Create a Controlled Input

Hi everybody,

It’s the third challenge that iam passing and something worng at the pageview.
i tryed to wirte in the input on the viewpage and i got eror worning on infinet loop,

the error msg: “Potential infinite loop detected on line 1. Tests may fail if this is not changed.
{ [Invariant Violation: Minified React error #152; visit[]=ControlledInput for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ] name: ‘Invariant Violation’, framesToPop: 1 }”

the code that i passed in:

class ControlledInput extends React.Component {
  constructor(props) {
    this.state = {
      input: ''
    // Change code below this line
    // Change code above this line
  // Change code below this line
  // Change code above this line
  render() {
    return (
        { /* Change code below this line */}
         <input value={this.state.input} onChange={this.handleChange}/>
        { /* Change code above this line */}
        <h4>Controlled Input:</h4>

I checked the solution an it pass but not working as well

If I take that code and put it into an app, it works fine. That error normally appears when you forget to return something, but that’s not the case here so there’s possibly an error somewhere in the code used to render the thing that you’re doing in the frame on the right (the fact the test passes fine suggests this is the case). I’ll have another look to see if I’ve missed something obvious, but whichever way I modify the code it a. always works if I put it into an app myself and b. triggers that error in the FCC editor.

I would move onto the next challenge, you have afaics done this correctly (strong caveat that this course is pretty behind in terms of a. JavaScript features & b. how React is normally written nowadays).

1 Like

Thanks, I was thinking that with all the changes this could be the case

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.