项目作者: SOURAV-ROY

项目描述 :
Google Custom Search Engine By ReactJS💚✔
高级语言: JavaScript
项目地址: git://github.com/SOURAV-ROY/google-clone.git
创建时间: 2020-10-18T08:33:17Z
项目社区:https://github.com/SOURAV-ROY/google-clone

开源协议:MIT License

下载


Google Clone

Use the package manager npm to install

  1. npm install react-router-dom
  2. npm install @material-ui/core
  3. npm install @material-ui/icons
  1. const UseGoogleSearch = (term) => {
  2. const [data, setData] = useState(null);
  3. useEffect(() => {
  4. const fetchData = async () => {
  5. fetch(`https://www.googleapis.com/customsearch/v1?key=${API_KEY}&cx=${CONTEXT_KEY}&q=${term}`)
  6. .then(response => response.json())
  7. .then(result => {
  8. setData(result)
  9. })
  10. }
  11. fetchData().then(res => {
  12. console.log(res);
  13. }).catch(error => {
  14. console.log(error);
  15. });
  16. }, [term]);
  17. return {data};
  18. };

All Credits Go To Clever Programmer