class keyword is not working properly, but className is in React-Grid-Layout.
See original GitHub issueHello,
I do like the naming of class in Preact instead of className in React.
On using react-grid-layout below, it seems that class keyword in tag affects properly in react-grid-layout. But, className keyword does not… https://github.com/STRML/react-grid-layout
I set the value of layout in graphContainer.css. class keyword is not applied…
import { h, Component } from 'preact';
import style from './graphContainer.css';
import GridLayout from 'react-grid-layout';
class GraphContainer extends Component{
render() {
return (
<GridLayout className="layout" cols={12} rowHeight={30} width={1200}>
<div key="a" data-grid={{x: 0, y: 0, w: 1, h: 2, static: true}}>a</div>
<div key="b" data-grid={{x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4}}>b</div>
<div key="c" data-grid={{x: 4, y: 0, w: 1, h: 2}}>c</div>
</GridLayout>
)
}
}
Do I have to use className out of preact?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
class keyword is not working properly, but className ... - GitHub
Hello, I do like the naming of class in Preact instead of className in React. On using react-grid-layout below, it seems that class...
Read more >Why We Don't Use Class Keyword in React? - YouTube
Why We Don't Use Class Keyword in React? | ClassName Keyword Explained #shorts. 9.9K views 1 year ago. codedamn. codedamn. 336K subscribers.
Read more >react-grid-layout-multi - npm
A draggable and resizable grid layout with responsive breakpoints, for React. Fork of original.. Latest version: 1.0.1, last published: a ...
Read more >React grid layout not working with firebase - Stack Overflow
In the original code, the images are all in a row however now they are all in one column. I am not too...
Read more >What does the className attribute mean in JSX?-Reactjs
In vanilla JavaScript className is used to assign classes because the class keyword makes a different type of class. M. Carr 107. Source:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you’re using css modules it may be that the styles just aren’t being referenced.
The difference being
class={style.layout}
instead ofclassName="layout"
You need to pass the name that the library expects - preact doesn’t normalize between the names except when applying props to DOM elements.
If
GridLayout
expects to be passedclassName="x"
, you have to pass it that way.You might find Preact Compat addresses this - it installs
className
as an alias ofclass
.