Ad

Uncaught ReferenceError: Block Is Not Defined

- 1 answer

I'm trying to pass css code into my react javascript and I get the following error -

Uncaught ReferenceError: block is not defined

Here is the relevant app.js code -

<div className="col-md-2">
    <div className="sidebar content-box" style={{display: block}}>
        <ul className="nav">
            <AppList data={this.state.data} />
        </ul>
    </div>
</div>

I'm using the css found here -

https://github.com/VinceG/Bootstrap-Admin-Theme-3/blob/master/css/styles.css

it works fine if the code is in the HTML like so -

<div class="sidebar content-box" style="display: block;">
Ad

Answer

the prop style expects an object of key value pairs here, and remember your in js land so your block needs to be either a variable or a quoted string.

use style={{display: "block"}} instead

Ad
source: stackoverflow.com
Ad