This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { GoogleAnalytics } from '@next/third-parties/google'; | |
export default async function RootLayout({ | |
children, | |
params, | |
}) { | |
return ( | |
<html lang='en'> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$module_search_dir = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'web/modules/custom'); | |
if ( !empty($argv[1]) ) { | |
$module_search_dir = realpath($argv[1]); | |
} | |
$module_dir = new RecursiveDirectoryIterator($module_search_dir); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$module_search_dir = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'web/modules/custom'); | |
if ( !empty($argv[1]) ) { | |
$module_search_dir = realpath($argv[1]); | |
} | |
$module_dir = new RecursiveDirectoryIterator($module_search_dir); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
useEffect( | |
() => { | |
// | |
// Here is where you perform some action based on the returned data | |
// | |
}, [data, isRefetching] | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Call refetch when inputValue changes */ | |
useEffect( | |
() => { | |
refetch(); | |
}, [inputValue] | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* call the useQuery hook, but leave the | |
* 'enabled' flag to false. Doing so prevents the query | |
* from running immediately on component mount. | |
*/ | |
const { data, refetch, isError, isRefetching } = useQuery( | |
['search_results', inputValue], | |
async () => { | |
return await axios.get(`/path/to/results/api/${inputValue}`).catch((err) => { //handle error here }) | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DebugModule from "debug"; | |
//create a debug logger for my-component inside my-app | |
const debug = DebugModule("my-app:my-component"); | |
//enable the my-app namespace for debugging | |
DebugModule.enable("my-app:*"); | |
debug("This message will print now since my-app:* namespace is enabled for debugging"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios"; | |
import regeneratorRuntime from "regenerator-runtime"; // eslint-disable-line no-unused-vars | |
const EmployeeDataClient = { | |
getResults: async(employee_id, endpoint_base_url) => { | |
endpoint_base_url = "http://localhost:3035/employees" | |
const response = await axios.get(`${endpoint_base_url}/${employee_id}`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function EmployeeSearchForm() { | |
const employee_data_client = useEmployeeDataClient(); | |
const loadResults = async(employee_id) => { | |
return await employee_data_client.getResults(employee_id); | |
} | |
/* Below here, the rest of the component; e.g. rendering a form that calls | |
loadResults */ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This file will hold the Menu that lives at the top of the Page, this is all rendered using a React Component... | |
* | |
*/ | |
import React, { useState } from 'react'; | |
import EmployeeSearchForm from './EmployeeSearchForm'; | |
import EmployeeDataProvider from "../services/EmployeeDataProvider"; | |
function Header() { |
NewerOlder