I'm trying to make a search box in Astrojs react with <input id="searchinput" type="text"/>
to my .include().map()
filter in posts.astro file.
I already tried to using document.document.getElementById('searchinput').value
(document
undefind) or write all these thing in .jsx
file but I can't create variableawait Astro.glob('./posts/*.mdx')
after I import astro.
code:
const posts = await Astro.glob('./posts/*.mdx')
(posts variable)
<input type="text" id="searchinput" />
(input)
posts.filter((post) =>post.frontmatter.title.toUpperCase().includes('') ||post.frontmatter.title.toLowerCase().includes('')).map((post) => ()
includes()
)