<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://wiki.kalen.pw/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://wiki.kalen.pw/feed.php">
        <title>wiki.kalen.pw development:javascript:react</title>
        <description></description>
        <link>https://wiki.kalen.pw/</link>
        <image rdf:resource="https://wiki.kalen.pw/lib/tpl/SimpleDoku/images/favicon.ico" />
       <dc:date>2026-05-30T16:15:28+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://wiki.kalen.pw/doku.php?id=development:javascript:react:absolute_imports&amp;rev=1625004316&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.kalen.pw/doku.php?id=development:javascript:react:pub_sub_event_bus&amp;rev=1625004291&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://wiki.kalen.pw/lib/tpl/SimpleDoku/images/favicon.ico">
        <title>wiki.kalen.pw</title>
        <link>https://wiki.kalen.pw/</link>
        <url>https://wiki.kalen.pw/lib/tpl/SimpleDoku/images/favicon.ico</url>
    </image>
    <item rdf:about="https://wiki.kalen.pw/doku.php?id=development:javascript:react:absolute_imports&amp;rev=1625004316&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-06-29T15:05:16+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Absolute Imports</title>
        <link>https://wiki.kalen.pw/doku.php?id=development:javascript:react:absolute_imports&amp;rev=1625004316&amp;do=diff</link>
        <description>Absolute Imports

----------

Add the following to jsconfig.json (or tsconfig.json)


{
  &quot;compilerOptions&quot;: {
    &quot;baseUrl&quot;: &quot;src&quot;
  },
  &quot;include&quot;: [&quot;src&quot;]
}


VSCode reads jsconfig.json files so IntelliSense will automatically work.

----------</description>
    </item>
    <item rdf:about="https://wiki.kalen.pw/doku.php?id=development:javascript:react:pub_sub_event_bus&amp;rev=1625004291&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-06-29T15:04:51+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Pub Sub / Event Bus</title>
        <link>https://wiki.kalen.pw/doku.php?id=development:javascript:react:pub_sub_event_bus&amp;rev=1625004291&amp;do=diff</link>
        <description>Pub Sub / Event Bus

Useful for when you don't want to include Redux, but would like to have events that can be triggered and listened to across unrelated components. 

----------

1) Create EventBus

I usually put this in src/Util/event_bus.js


const EventBus = {
    /**
     * events stored as object with each field being an event
     */
    events: {},
    /**
     * Call all callbacks for given event
     * @param {string} event name of event
     * @param {*} data data sent to all event c…</description>
    </item>
</rdf:RDF>
