我已经将 Algolia 添加到我的 gatsby 项目中,它工作得很好但是当我想自定义搜索框时我遇到了问题我需要一些帮助在这里请我的朋友这是我第一次使用这个插件感谢你的帮助
当我将搜索框组件从“react-instantsearch-dom”更改为自定义时,请给我这个错误任何帮助。
import React from "react"
import { graphql } from "gatsby"
import { InstantSearch, Hits, SearchBox } from "react-instantsearch-dom"
import algoliasearch from "algoliasearch/lite"
import SEO from "../components/seo"
import Article from "../components/article"
import {Articles} from "../style/styles"
import Layout from "../components/layout"
const Blog = () => {
const searchClient = algoliasearch(
"XXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
)
return (
<Layout>
<SEO title="blog Page" />
<h1>Hello</h1>
<InstantSearch indexName="hma" searchClient={searchClient} >
<div className="right-panel">
<SearchBox />
<Articles>
<Hits hitComponent={Article} />
</Articles>
</div>
</InstantSearch>
</Layout>
)
}
export const query = graphql`
query($skip: Int!, $limit: Int!) {
blogs: allMdx(
filter: { fileAbsolutePath: { regex: "//data/blogs//" } }
sort: { order: ASC, fields: frontmatter___date }
limit: $limit
skip: $skip
) {
edges {
node {
fields {
slug
}
frontmatter {
title
tags
keywords
image
description
author
category
}
}
}
}
}
`
export default Blog
POPMUISE
相关分类