Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
How can I make my react search engine to accept both upper and lower case letters?

Hi there my react application is a todolist and has a search engine to filter notes, currently it works if you search for the note but in lower case, how could I make it accept both upper and lower case?

For example, for the javaScript note, it would find it whether I put JAVAscrIPT or jAVAscriPT.

This is my code

const App = () => {
  const [notes, setNotes] = useState([]);
  const [searchText, setSearchText] = useState('');
  const [showNote, setShowNote] = useState(true); //eslint-disable-lint

  const addNote = (inputText, text) => { 
    const date = new Date();
    const newNote = {
      id: nanoid(),
      title: inputText,
      text: text,
      date: date.toLocaleString()
      
    }
    const newNotes = [newNote, ...notes];
    setNotes(newNotes)
  }
  const filterNotes = notes.filter((noteText) => noteText.title.toLowerCase().includes(searchText)); 

//rest of code

A greeting and thanks in advance!

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

You forgot to use toLowerCase on searchText

const filterNotes = notes.filter((noteText) => noteText.title.toLowerCase().includes(searchText.toLowerCase())); 
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!