EventDispatchCase.js — react Source File
Architecture documentation for EventDispatchCase.js, a javascript file in the react codebase. 5 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 43ace571_1950_dfaa_ad2d_343c5795cb78["EventDispatchCase.js"] 14dde3c9_48ef_6e34_3667_978d06aff15d["TestCase.js"] 43ace571_1950_dfaa_ad2d_343c5795cb78 --> 14dde3c9_48ef_6e34_3667_978d06aff15d e1e356f5_b085_dad5_a81f_4b4844381311["TestCase"] 43ace571_1950_dfaa_ad2d_343c5795cb78 --> e1e356f5_b085_dad5_a81f_4b4844381311 bc8ae172_cc20_3692_943c_bbdb1ad34855["Fixture.js"] 43ace571_1950_dfaa_ad2d_343c5795cb78 --> bc8ae172_cc20_3692_943c_bbdb1ad34855 2851624d_a736_f3f6_2132_5a20630983fe["Fixture"] 43ace571_1950_dfaa_ad2d_343c5795cb78 --> 2851624d_a736_f3f6_2132_5a20630983fe a3aeab4c_4f93_b8d8_01c2_7a351a28a3fb["Fixture"] 43ace571_1950_dfaa_ad2d_343c5795cb78 --> a3aeab4c_4f93_b8d8_01c2_7a351a28a3fb 463c662d_adfd_912e_a87b_b390bc35e100["index.js"] 463c662d_adfd_912e_a87b_b390bc35e100 --> 43ace571_1950_dfaa_ad2d_343c5795cb78 style 43ace571_1950_dfaa_ad2d_343c5795cb78 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import TestCase from '../../TestCase';
import Fixture from '../../Fixture';
const React = window.React;
const {Fragment, useRef, useState} = React;
function WrapperComponent(props) {
return props.children;
}
const initialState = {
child: false,
parent: false,
grandparent: false,
};
export default function EventListenerCase() {
const fragmentRef = useRef(null);
const [clickedState, setClickedState] = useState({...initialState});
const [fragmentEventFired, setFragmentEventFired] = useState(false);
const [bubblesState, setBubblesState] = useState(true);
function setClick(id) {
setClickedState(prev => ({...prev, [id]: true}));
}
function fragmentClickHandler(e) {
setFragmentEventFired(true);
}
return (
<TestCase title="Event Dispatch">
<TestCase.Steps>
<li>
Each box has regular click handlers, you can click each one to observe
the status changing through standard bubbling.
</li>
<li>Clear the clicked state</li>
<li>
Click the "Dispatch click event" button to dispatch a click event on
the Fragment. The event will be dispatched on the Fragment's parent,
so the child will not change state.
</li>
<li>
Click the "Add event listener" button to add a click event listener on
the Fragment. This registers a handler that will turn the child blue
on click.
</li>
<li>
Now click the "Dispatch click event" button again. You can see that it
will fire the Fragment's event handler in addition to bubbling the
click from the parent.
</li>
<li>
If you turn off bubbling, only the Fragment's event handler will be
called.
</li>
</TestCase.Steps>
<TestCase.ExpectedResult>
// ... (98 more lines)
Domain
Subdomains
Functions
Dependencies
Source
Frequently Asked Questions
What does EventDispatchCase.js do?
EventDispatchCase.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in EventDispatchCase.js?
EventDispatchCase.js defines 2 function(s): EventListenerCase, WrapperComponent.
What does EventDispatchCase.js depend on?
EventDispatchCase.js imports 5 module(s): Fixture, Fixture, Fixture.js, TestCase, TestCase.js.
What files import EventDispatchCase.js?
EventDispatchCase.js is imported by 1 file(s): index.js.
Where is EventDispatchCase.js in the architecture?
EventDispatchCase.js is located at fixtures/dom/src/components/fixtures/fragment-refs/EventDispatchCase.js (domain: BabelCompiler, subdomain: Entrypoint, directory: fixtures/dom/src/components/fixtures/fragment-refs).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free