React css模块化样式判断

import React, { Fragment } from 'react'
import style from "./TaskItem.module.less";

function TaskItem(props) {
    let { item, idNow } = props
    let { title, username, id } = item
    const dragStart = (e) => {
        props.dragStart(id)
    }
    const dragEnd = (e) => {
        e.preventDefault();
        props.dragEnd()
    }
    return (
        <Fragment>
            <div
                className={style["list"] + " " + style[ idNow == id?"active":''] }
                draggable="true"
                onDragStart={dragStart}
                onDragEnd={dragEnd}
            >
                <header className={style.header}>
                    {username}
                </header>
                <main className={style.main}>
                    {title}
                </main>
            </div>
        </Fragment>
    

你可能感兴趣的:(React css模块化样式判断)