Answer the question
In order to leave comments, you need to log in
How to capture class in reactjs function?
I recently started learning React and was wondering how to grab a class from a modular css
const Bar = (props) => {
return (
<div className={b.item}>
<span className={b.name}>{props.nameSkill}</span>
<div className={b.max_bar}>
<div className={b.percent_bar} onLoad={bar}>{props.percent}%</div>
</div>
</div>
);
function bar() {
const elem = document.querySelector(".percent_bar");
const w = props.percent;
const opercent = document.querySelector(".max_bar").style.width / 100;
elem.style.width = w * opercent + "px";
}
};
const opercent = document.querySelector(b.max_bar).style.width / 100;
const elem = document.querySelector(_Bar_module_css__WEBPACK_IMPORTED_MODULE_1___default.a.percent_bar);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question