A
A
Alexey Yakovlev2021-08-22 20:19:22
React
Alexey Yakovlev, 2021-08-22 20:19:22

How to check if a note is not found?

Here's how I make note routes:

{notesRedux.length ? notesRedux.map((item: any,index: any) => {
                return (
                  <Route exact path={"/note/"+index} key={index}>
                    <NoteText
                      title={item.title}
                      time={item.time}
                      text={item.text}
                      create={false}
                    />
                  </Route>
                )
              }) : false}


It is necessary to make it so that if the note is not found on such a route, then transfer it to the main page.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question