$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>javascript - Error: error: Expected ',', got 'className' in nextjs - Stack Overflow|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Error: error: Expected ',', got 'className' in nextjs - Stack Overflow

matteradmin6PV0评论

Error: error: Expected ',', got 'className' in nextjs

I'm trying to make a sign-in page using bootstrap 4, but it shows above error after piling.

It shows error on 15 line of div tag

    return (

        <Head>
            <title>Sign in</title>
        </Head>
        <form>
            <div className="form-group">
                <label for="exampleInputEmail1">Email address</label>
                <small id="emailHelp" className="form-text text-muted">We'll never share your email with anyone else.</small>
            </div>
            <div className="form-group">

                <label for="exampleInputPassword1">Password</label>

                <input type="password" className="form-control" id="exampleInputPassword1" placeholder="Password" />
            </div>
            <div className="form-check">
                <input type="checkbox" className="form-check-input" id="exampleCheck1" />
                <label className="form-check-label" for="exampleCheck1">Check me out</label>
            </div>
            
            <button type="submit" className="btn btn-primary">Submit</button>
        </form> 
    )
}

export default signin

Error: error: Expected ',', got 'className' in nextjs

I'm trying to make a sign-in page using bootstrap 4, but it shows above error after piling.

It shows error on 15 line of div tag

    return (

        <Head>
            <title>Sign in</title>
        </Head>
        <form>
            <div className="form-group">
                <label for="exampleInputEmail1">Email address</label>
                <small id="emailHelp" className="form-text text-muted">We'll never share your email with anyone else.</small>
            </div>
            <div className="form-group">

                <label for="exampleInputPassword1">Password</label>

                <input type="password" className="form-control" id="exampleInputPassword1" placeholder="Password" />
            </div>
            <div className="form-check">
                <input type="checkbox" className="form-check-input" id="exampleCheck1" />
                <label className="form-check-label" for="exampleCheck1">Check me out</label>
            </div>
            
            <button type="submit" className="btn btn-primary">Submit</button>
        </form> 
    )
}

export default signin
Share Improve this question edited Jan 5, 2022 at 16:56 vaidik Gupta asked Jan 5, 2022 at 16:48 vaidik Guptavaidik Gupta 451 gold badge1 silver badge6 bronze badges 2
  • The code provided seems unrelated to the error. – evolutionxbox Commented Jan 5, 2022 at 16:52
  • Does this answer your question? React - expressions must have one parent element? – juliomalves Commented Jan 7, 2022 at 18:10
Add a ment  | 

1 Answer 1

Reset to default 3

ReactJS doesn't allow 2 parent elements, make sure to use a div as parent element

return (
    <div>
        <Head>
            ...
        </Head> 
        <form> 
            ...
        </form> 
    </div>
 )
Post a comment

comment list (0)

  1. No comments so far