Skip to content

Instantly share code, notes, and snippets.

View jbournonville's full-sized avatar

Julien Bournonville jbournonville

  • France
View GitHub Profile
@jbournonville
jbournonville / nationalites.json
Created August 5, 2020 06:51
Liste des nationalités au format JSON
[
{
"id": "1",
"code": "4",
"alpha2": "AF",
"alpha3": "AFG",
"nom_fr_fr": "Afghanistan",
"nom_en_gb": "Afghanistan"
},
{
@jbournonville
jbournonville / OnBlurComponent.jsx
Created February 2, 2021 14:40 — forked from pstoica/OnBlurComponent.jsx
onBlur for entire react element
function OnBlurComponent({ onBlur }) {
const handleBlur = (e) => {
const currentTarget = e.currentTarget;
// Check the newly focused element in the next tick of the event loop
setTimeout(() => {
// Check if the new activeElement is a child of the original container
if (!currentTarget.contains(document.activeElement)) {
// You can invoke a callback or add custom logic here
onBlur();