1nwf / Produx-v2

Logical operator can be refactored to optional chain JS-W1044
Anti-pattern
Minor
5 occurrences in this check
Prefer using an optional chain expression instead, as it's more concise and easier to read
 49                <link
 50                    rel="icon"
 51                    href={
 52                        data && data.product.images 53                            ? data.product.images[0]
 54                            : '/produx2.png'
 55                    }
Prefer using an optional chain expression instead, as it's more concise and easier to read
 28    }, [getProduct, name])
 29    const [showPrivate, setShowPrivate] = useState(false)
 30    useEffect(() => {
 31        if (data && data.product.private) { 32            checkIfFollowed(data.product.ID).then((res) => {
 33                if (res.data.followed) {
 34                    setShowPrivate(false)
Prefer using an optional chain expression instead, as it's more concise and easier to read
 88                    >
 89                        Select images
 90                    </div>
 91                    {images && 92                        images.map((i, idx) => ( 93                            <div 94                                key={idx} 95                                className={'flex justify-center w-full'} 96                            > 97                                {' '} 98                                <img 99                                    src={URL.createObjectURL(i)}100                                    className={101                                        'max-w-[89%] max-h-[80vh] object-contain rounded-box'102                                    }103                                />104                            </div>105                        ))}106
107                    <input
108                        type={'file'}
Prefer using an optional chain expression instead, as it's more concise and easier to read
167                <div
168                    className={'grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3'}
169                >
170                    {userInfo &&171                        userInfo.products &&172                        userInfo.products.map((p) => {
173                            return (
174                                <div key={p.ID} className={'flex items-center'}>
Prefer using an optional chain expression instead, as it's more concise and easier to read
24    }, [channel, getProduct, name, postId])
25    const [showPrivate, setShowPrivate] = useState(false)
26    useEffect(() => {
27        if (data && data.product.private) {28            checkIfFollowed(data.product.ID).then((res) => {
29                if (res.data.followed) {
30                    setShowPrivate(false)