Refactor React Context (ComponentHtmlMapContext) to Redux to allow for better extensibility
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3499446. -->
Reported by: [jessebaker](https://www.drupal.org/user/3546546)
>>>
<h3 id="overview">Overview</h3>
<p>I initially implemented the HTML to Component map as a React Context in <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/experience_builder/issues/3491021" title="Status: Closed (fixed)">#3491021: Leverage HTML comment annotations, remove wrapping div elements </a></span>. I think landing that MR is super important, however @hooroomoo made a very valid point in the MR that there are a few reasons that using Redux instead might be a better choice.</p>
<p>1) It is potentially slightly more performant<br>
2) It is more consistent with the rest of the codebase (the only other use of Context was refactored away already)</p>
<p>Then, in a follow up discussion with the wider team it was realised that, even more excitingly...</p>
<p>3) It would allow the map to be exposed externally to allow for better extensibility. See <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/experience_builder/issues/3485692" title="Status: Closed (fixed)">#3485692: Create extendibility proof of concept that also serves as documentation-by-example (extensions)</a></span> which makes the Redux store available outside of the React application..</p>
<h3 id="proposed-resolution">Proposed resolution</h3>
<p>Take the <code>ComponentHtmlMapContext.tsx </code> and refactor it into a new Redux Slice that has just one action (replacing the whole map with a new one) that is called when the HTML is received from the server and consumed by the preview overlay components instead of the Context.</p>
<p>This MR is <em>just to perform the refactor</em>, the extensibility can be tackled later.</p>
> Related issue: [Issue #3491021](https://www.drupal.org/node/3491021)
> Related issue: [Issue #3485692](https://www.drupal.org/node/3485692)
issue