V
V
Vitaly2020-03-21 23:54:25
React
Vitaly, 2020-03-21 23:54:25

How to link to images correctly?

I am writing an application in React and Cordova. I ran into a problem with specifying image addresses: on the web they start with a slash, in cordova they must be absolute paths to the file system. The project was created using the cordova and create-react-app utilities.

How do I configure webpack or cordova to accommodate these specifics?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Spirin, 2019-08-25
@polyak-888

What's the point of writing state from store to component state? Use the state from the store directly.
The best thing, in this case, is to store the filter state somewhere and filter the data from the store on the fly.

const phoneList = useSelector((state) => state.phoneListReducer.phoneList);
const [search, setSearch] = useState('');
const filteredPhoneList = useMemo(
  () => phoneList.filter(phone => phone.includes(search)),
  [search],
);

H
Hlib, 2019-08-24
@Mysianio

Try

useEffect(()=>{
    setSearchList([...listPhoneSearch])
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question