V
V
Vladimir Golub2019-05-02 12:15:28
React
Vladimir Golub, 2019-05-02 12:15:28

How to create a css class inside a component and apply it to an element?

How to create a CSS class inside a React component and then apply it to an element.
For example, I create a class .list and apply it className={ list }, but to keep the name without any hashes, as in aphoride.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Anton Spirin, 2019-05-02
@RazerVG

<div className="list" />

const className = 'list';

return <div className={className} />;

A
alex kapustsin, 2019-05-02
@holysheepcoder

This package is very helpful. classNames helps a lot

F
fomenko_alexandr, 2017-04-04
@fomenko_alexandr

Went the other way. Since anyway, there were not many records. Then I just added a new variable - count, which counts the number of records with status 1, and I skip checking if there are already more than 3 records.

if($row->status == '1') {
    if($count >= 3)
        continue;

        $count++;
}

O
Oleg, 2017-04-04
@Austin_Powers

try like this:

SELECT * FROM *your_table_name* WHERE status =  1 LIMIT 3
UNION
SELECT * FROM *your_table_name* WHERE status =  0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question