{"id":6247,"date":"2022-12-05T05:05:45","date_gmt":"2022-12-05T05:05:45","guid":{"rendered":"https:\/\/studysection.com\/blog\/?p=6247"},"modified":"2022-12-05T05:35:49","modified_gmt":"2022-12-05T05:35:49","slug":"react-reactjs-module-design-pattern","status":"publish","type":"post","link":"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/","title":{"rendered":"React \/ ReactJS &#8211; Module Design Pattern"},"content":{"rendered":"<p>React is likely the most well-liked JavaScript library for creating user interfaces, in part because of its impartiality. No matter if you choose to view <a href=\"https:\/\/studysection.com\/blog\/observer-pattern-in-react-reactjs\/\">React<\/a> as a framework or library, one thing that can be agreed upon is its hands-off approach to how developers should construct React applications, which provides developers and developer teams the freedom to determine how they want their applications to be made. After working on many React projects with various teams and researching previously created React applications, you identify some common design patterns.<br \/>\nIn this article, we&#8217;ll be looking at three popular design patterns for building React applications.<\/p>\n<ol>\n<li>\n<h2>Presentational and Container Component Pattern<\/h2>\n<p>This is a pattern coined by Dan Abramov. during this pattern, components are divided into:<br \/>\n<strong>Presentation Components:<\/strong> These are components that are liable for how the UI looks. They don\u2019t have any dependencies on any part of the application and are used to display data. An example may be a list:<br \/>\n<code>const ItemsList = (props) =&gt; {<br \/>\nreturn (<br \/>\n&lt;ul&gt;<br \/>\n{props.items.map((item) =&gt; (<br \/>\n&lt;li key={item.id}&gt;<br \/>\n&lt;a href={item.url}&gt;{item.name}&lt;\/a&gt;<br \/>\n&lt;\/li&gt;<br \/>\n))}<br \/>\n&lt;\/ul&gt;<br \/>\n);<br \/>\n};<\/code><br \/>\nIn the example above, our ItemsList component is merely responsible for displaying the data passed as props on the user interface. Presentational components are also called stateless. functional components but can also be written as class components and can contain state that relates to the UI.<br \/>\n<code>class TextInput extends React.Component {<br \/>\nconstructor(props) {<br \/>\nsuper(props);<br \/>\nthis.state = {<br \/>\nvalue: \"\"<br \/>\n};<br \/>\n}<br \/>\nrender() {<br \/>\nreturn (<br \/>\n&lt;input value={this.state.value}onChange={(event) =&gt; this.setState({ value: event.target.value })}\/&gt;<br \/>\n);<br \/>\n}<br \/>\n}<\/code><br \/>\nIn the example above, we\u2019ve created a presentational class component, TextInput, liable for managing its state.<br \/>\n<strong>Container Components:<\/strong> Unlike presentational components, container components are skilled in how things work. They&#8217;re usually class components that contain lifecycle methods and presentational components. It&#8217;s also where data fetching happens.<br \/>\n<code>class TvShowsContainer extends React.Component {<br \/>\nconstructor(props) {<br \/>\nsuper(props);<br \/>\nthis.state = {<br \/>\nshows: [],<br \/>\nloading: false,<br \/>\nerror: \"\"<br \/>\n};<br \/>\n}<br \/>\ncomponentDidMount() {<br \/>\nthis.setState({ loading: true, error: \"\" });<br \/>\nfetch(\"https:\/\/api.tvmaze.com\/schedule\/web?date=2020-05-29\")<br \/>\n.then((res) =&gt; res.json())<br \/>\n.then((data) =&gt; this.setState({ loading: false, shows: data }))<br \/>\n.catch((error) =&gt;<br \/>\nthis.setState({ loading: false, error: error.message || error })<br \/>\n);<br \/>\n}<br \/>\nrender() {<br \/>\nconst { loading, error, shows } = this.state;<br \/>\nreturn (<br \/>\n&lt;div&gt;<br \/>\n&lt;h1&gt; Tv Shows &lt;\/h1&gt;<br \/>\n{loading &amp;&amp; &lt;p&gt;Loading...&lt;\/p&gt;}<br \/>\n{!loading &amp;&amp; shows &amp;&amp; &lt;ItemsList items={shows} \/&gt;}<br \/>\n{!loading &amp;&amp; error &amp;&amp; &lt;p&gt;{error}&lt;\/p&gt;}<br \/>\n&lt;\/div&gt;<br \/>\n);<br \/>\n}<br \/>\n}<\/code><br \/>\nWe\u2019ve created a TVShowsContainer component that fetches data from an API when the component mounts within the example above. Additionally, it sends that information to the ItemsList presentational component that we earlier created. The separation of concerns and component reuse are advantages of this pattern. Other container components can reuse the ItemList presentational component to display data since it doesn\u2019t tightly include the TvShowsListContainer. You&#8217;ll view the working application here.<br \/>\nDo note that Dan also mentions that he\u2019s not promoting this pattern as he\u2019s changed his view on the matter since he originally coined it. However, you would possibly find it useful for your particular use case which is why I thought it relevant to be mentioned on this list.<\/li>\n<li>\n<h3>Provider Pattern<\/h3>\n<p>Prop drilling is a huge issue for React developers. Prop drilling may be a scenario in which data (props) is passed down to different components until it gets to the component where the prop is needed. While prop-drilling isn\u2019t bad, it becomes an issue when unrelated components share data, which brings us to the Provider pattern. The Provider pattern allows us to store data in a central location, e.g., the React Context object, and therefore the Redux store. Any component that requires this information can then receive it directly from the Context Provider\/Store without probing any props.<br \/>\nImagine implementing dark mode for an internet app and making unrelated components respond to a theme change triggered by a different component. We will achieve that using the Provider pattern. We create a React context object for storing the worth of the theme.<br \/>\n<code>import { createContext } from \"react\";<br \/>\nconst ThemeContext = createContext({<br \/>\ntheme: \"light\",<br \/>\nsetTheme: () =&gt; {}<br \/>\n});<br \/>\nexport default ThemeContext;<\/code><\/p>\n<p><em>In the App.js file, we wrap imported components with ThemeContext.Provider. This gives the different components, and their children access to the Context object created<\/em><\/p>\n<p>import React, { useState, useMemo } from &#8220;react&#8221;;<br \/>\nimport Header from &#8220;.\/Header&#8221;;<br \/>\nimport Main from &#8220;.\/Main&#8221;;<br \/>\nimport ThemeContext from &#8220;.\/context&#8221;;<br \/>\nimport &#8220;.\/styles.css&#8221;;<br \/>\nexport default function App() {<br \/>\nconst [theme, setTheme] = useState(&#8220;&#8221;);<br \/>\nconst value = useMemo(() =&gt; ({ theme, setTheme }), [theme]);<br \/>\nreturn (<br \/>\n&lt;ThemeContext.Provider value={value}&gt;<br \/>\n&lt;div className=&#8221;container&#8221;&gt;<br \/>\n&lt;Header \/&gt;<br \/>\n&lt;Main \/&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/ThemeContext.Provider&gt;<br \/>\n);<br \/>\n}<br \/>\nThemeContexts cannot be modified by default because they are stateless. To unravel this, we will connect the ThemeContext to a state and provide an update function in the ThemeContext to modify the state.<br \/>\nTo access ThemeContext within the components, we will make use of the useContext hook introduced in React 16.9.<br \/>\n<code>import { useContext } from \"react\";<br \/>\nimport ThemeContext from \".\/context\";<br \/>\nconst Header = () =&gt; {<br \/>\nconst { theme, setTheme } = useContext(ThemeContext);<br \/>\nconst toggleTheme = () =&gt; {<br \/>\nif (theme === \"dark\") {<br \/>\nsetTheme(\"\");<br \/>\nreturn;<br \/>\n}<br \/>\nsetTheme(\"dark\");<br \/>\nreturn;<br \/>\n};<br \/>\nreturn (<br \/>\n&lt;header className={theme === \"dark\" &amp;&amp; \"dark\"}&gt;<br \/>\n&lt;h1&gt; Tv Shows &lt;\/h1&gt;<br \/>\n&lt;button onClick={toggleTheme}&gt;Toggle Theme&lt;\/button&gt;<br \/>\n&lt;\/header&gt;<br \/>\n);<br \/>\n};<br \/>\nexport default Header;<br \/>\nimport { useContext } from \"react\";<br \/>\nimport ThemeContext from \".\/context\";<br \/>\nconst Main = () =&gt; {<br \/>\nconst { theme } = useContext(ThemeContext);<br \/>\nreturn (<br \/>\n&lt;main className={theme === \"dark\" &amp;&amp; \"dark\"}&gt;<br \/>\n&lt;h2&gt;{\" \"} {theme === \"dark\" ? \"Dark theme enabled\" : \"Light theme enabled\"}&lt;\/h2&gt;<br \/>\n&lt;\/main&gt;<br \/>\n);<br \/>\n};<br \/>\nexport default Main;<\/code><br \/>\nWhile Context makes it easier to pass data among components, it&#8217;s advised to use this approach sparingly because it makes component reuse difficult. You&#8217;ll access the working app of the example above here. The Provider pattern is employed in React Router and React-Redux.<\/li>\n<li>\n<h3>Compound Components Pattern<\/h3>\n<p>Compound components are components that share a state and work together to achieve a common goal. An example is the &lt;select&gt; and &lt;option&gt; HTML elements. When combined, they create a drop-down menu, but they don\u2019t achieve much on their own.<\/p>\n<p>The Compound Components pattern is used in popular React UI libraries, e.g. Ant Design and Material UI. Below is an implementation of the Menu component in Material UI<br \/>\n<code>import * as React from 'react';<br \/>\nimport Menu from '@mui\/material\/Menu';<br \/>\nimport MenuItem from '@mui\/material\/MenuItem';<br \/>\nexport default function MaterialMenu() {<br \/>\nreturn (<br \/>\n&lt;div&gt;<br \/>\n&lt;Button&gt; Menu &lt;\/Button&gt;<br \/>\n&lt;Menu&gt;<br \/>\n&lt;MenuItem&gt;Profile&lt;\/MenuItem&gt;<br \/>\n&lt;MenuItem&gt;My account&lt;\/MenuItem&gt;<br \/>\n&lt;MenuItem&gt;Logout&lt;\/MenuItem&gt;<br \/>\n&lt;\/Menu&gt;<br \/>\n&lt;\/div&gt;<br \/>\n);<br \/>\n}<\/code><br \/>\nWithout compound components, we&#8217;ll have had to pass props to the parent component, then the parent component passes the data down to child components<br \/>\n<code>&lt;Menu items={['Profile','My account', 'Logout']} \/&gt;<\/code><br \/>\nThe above looks simple, but we start having problems passing more props right down to the child component. for instance, imagine we wanted a default selected menu item<br \/>\n<code>&lt;Menu items={['Profile', 'My account', 'Logout']} defaultSelected={1} \/&gt;<\/code><br \/>\nAs more requirements are available, the component starts becoming messy and unusable. A simpler method to do this is by using the compound component pattern.<br \/>\nThere are two ways to create a React component using the compound component pattern approach:<\/p>\n<ul>\n<li>React.cloneElement<\/li>\n<li>React Context<\/li>\n<\/ul>\n<p><em>I\u2019ll be using the React Context approach for the instance below<\/em><br \/>\n<code>import {<br \/>\ncreateContext,<br \/>\nuseState,<br \/>\nuseCallback,<br \/>\nuseMemo,<br \/>\nuseContext<br \/>\n} from \"react\";<br \/>\nimport \".\/styles.css\";<br \/>\nconst MenuContext = createContext();<br \/>\nconst Menu = ({ children, defaultSelected }) =&gt; {<br \/>\nconst [selectedItem, setSelectedItem] = useState(defaultSelected);<br \/>\nconst toggleSelectedItem = useCallback(<br \/>\n(item) =&gt; {<br \/>\nif (item !== selectedItem) {<br \/>\nsetSelectedItem(item);<br \/>\nreturn;<br \/>\n}<br \/>\nselectedItem(\"\");<br \/>\n},<br \/>\n[selectedItem, setSelectedItem]\n);<br \/>\nconst value = useMemo(<br \/>\n() =&gt; ({<br \/>\ntoggleSelectedItem,<br \/>\nselectedItem<br \/>\n}),<br \/>\n[toggleSelectedItem, selectedItem]\n);<br \/>\nreturn (<br \/>\n&lt;MenuContext.Provider value={value}&gt;<br \/>\n&lt;menu className=\"menu\"&gt;{children}&lt;\/menu&gt;<br \/>\n&lt;\/MenuContext.Provider&gt;<br \/>\n);<br \/>\n};<\/code><br \/>\nUsing the createContext function of the React Context API, we&#8217;ve built a context object, MenuContext, for the Menu component. This may hold the shared state for the Menu and MenuItem components. We\u2019ve also created a state for a specific menu item. This may allow us to update the context similar to what we did in the Provider Pattern since the Context API is stateless by design.<br \/>\nThe next step is building the MenuItem Component.<br \/>\n<code>const useMenuContext = () =&gt; {<br \/>\nconst context = useContext(MenuContext);<br \/>\nif (!context) {<br \/>\nthrow new Error(<br \/>\n\"Menu item component cannot be used outside the Menu component.\"<br \/>\n);<br \/>\n}<br \/>\nreturn context;<br \/>\n};<br \/>\nconst MenuItem = ({ value, children }) =&gt; {<br \/>\nconst { toggleSelectedItem, selectedItem } = useMenuContext();<br \/>\nreturn (<br \/>\n&lt;button onClick={() =&gt; toggleSelectedItem(value)} id={`${value}-menu-item`} className={`menu__item ${selectedItem === value &amp;&amp; \"active\"}`} &gt;{children}&lt;\/button&gt;<br \/>\n);<br \/>\n};<\/code><br \/>\nThe first thing done here is creating a custom hook useMenuContext for checking if the MenuItem is used outside the Menu component and throwing an error if that happens. then, we create our MenuItem utilizing the shared state with the Menu component to detect what style to use to a selected MenuItem and change the selected item when a menu item is clicked.<br \/>\nTo wrap up, we connect these components together within the App component.<br \/>\n<code>export default function App() {<br \/>\nreturn (<br \/>\n&lt;Menu defaultSelected=\"My account\"&gt;<br \/>\n&lt;MenuItem value=\"Profile\"&gt;Profile&lt;\/MenuItem&gt;<br \/>\n&lt;MenuItem value=\"My account\"&gt;My account&lt;\/MenuItem&gt;<br \/>\n&lt;MenuItem value=\"Logout\"&gt;Logout&lt;\/MenuItem&gt;<br \/>\n&lt;\/Menu&gt;<br \/>\n);<br \/>\n}<\/code><\/li>\n<\/ol>\n<h3>Conclusion<\/h3>\n<p>In this article, we\u2019ve checked out various design patterns to use in building React components that are extensible and reusable. While this is often not an exhaustive list, it applies to most problems you&#8217;ll probably encounter when building components.<\/p>\n<p><small><em>If you have skills in PHP programming and you want to enhance your career in this field, a PHP certification from StudySection can help you reach your desired goals. Both beginner level and expert level <a href=\"https:\/\/www.studysection.com\/php-web-developer-foundation-diploma\">PHP Certification Exams<\/a> are offered by StudySection along with other programming certification exams. <\/em><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>React is likely the most well-liked JavaScript library for creating user interfaces, in part because of its impartiality. No matter<\/p>\n","protected":false},"author":1,"featured_media":6248,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[822,641],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>React \/ ReactJS - Module Design Pattern - StudySection Blog<\/title>\n<meta name=\"description\" content=\"Due in part to its objectivity, React is arguably the most well-liked JavaScript library for making user interfaces.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"React \/ ReactJS - Module Design Pattern - StudySection Blog\" \/>\n<meta property=\"og:description\" content=\"Due in part to its objectivity, React is arguably the most well-liked JavaScript library for making user interfaces.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog Posts on famous people, innovations and educational topics\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/studysection\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-05T05:05:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-05T05:35:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2022\/12\/Module-Design.png\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin-studysection-blog\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@studysection\" \/>\n<meta name=\"twitter:site\" content=\"@studysection\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin-studysection-blog\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/\"},\"author\":{\"name\":\"admin-studysection-blog\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\"},\"headline\":\"React \/ ReactJS &#8211; Module Design Pattern\",\"datePublished\":\"2022-12-05T05:05:45+00:00\",\"dateModified\":\"2022-12-05T05:35:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/\"},\"wordCount\":1132,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"keywords\":[\"Module Design\",\"Reactjs\"],\"articleSection\":[\"Learn and Grow\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/\",\"url\":\"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/\",\"name\":\"React \/ ReactJS - Module Design Pattern - StudySection Blog\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/#website\"},\"datePublished\":\"2022-12-05T05:05:45+00:00\",\"dateModified\":\"2022-12-05T05:35:49+00:00\",\"description\":\"Due in part to its objectivity, React is arguably the most well-liked JavaScript library for making user interfaces.\",\"breadcrumb\":{\"@id\":\"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/studysection.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"React \/ ReactJS &#8211; Module Design Pattern\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/studysection.com\/blog\/#website\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"name\":\"Blog Posts on famous people, innovations and educational topics\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/studysection.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/studysection.com\/blog\/#organization\",\"name\":\"StudySection\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"contentUrl\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"width\":920,\"height\":440,\"caption\":\"StudySection\"},\"image\":{\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/studysection\",\"https:\/\/twitter.com\/studysection\",\"https:\/\/www.instagram.com\/study.section\/\",\"https:\/\/www.linkedin.com\/company\/studysection\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\",\"name\":\"admin-studysection-blog\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"caption\":\"admin-studysection-blog\"},\"url\":\"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"React \/ ReactJS - Module Design Pattern - StudySection Blog","description":"Due in part to its objectivity, React is arguably the most well-liked JavaScript library for making user interfaces.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/","og_locale":"en_US","og_type":"article","og_title":"React \/ ReactJS - Module Design Pattern - StudySection Blog","og_description":"Due in part to its objectivity, React is arguably the most well-liked JavaScript library for making user interfaces.","og_url":"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/","og_site_name":"Blog Posts on famous people, innovations and educational topics","article_publisher":"https:\/\/www.facebook.com\/studysection","article_published_time":"2022-12-05T05:05:45+00:00","article_modified_time":"2022-12-05T05:35:49+00:00","og_image":[{"width":300,"height":200,"url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2022\/12\/Module-Design.png","type":"image\/png"}],"author":"admin-studysection-blog","twitter_card":"summary_large_image","twitter_creator":"@studysection","twitter_site":"@studysection","twitter_misc":{"Written by":"admin-studysection-blog","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/#article","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/"},"author":{"name":"admin-studysection-blog","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402"},"headline":"React \/ ReactJS &#8211; Module Design Pattern","datePublished":"2022-12-05T05:05:45+00:00","dateModified":"2022-12-05T05:35:49+00:00","mainEntityOfPage":{"@id":"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/"},"wordCount":1132,"commentCount":0,"publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"keywords":["Module Design","Reactjs"],"articleSection":["Learn and Grow"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/","url":"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/","name":"React \/ ReactJS - Module Design Pattern - StudySection Blog","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/#website"},"datePublished":"2022-12-05T05:05:45+00:00","dateModified":"2022-12-05T05:35:49+00:00","description":"Due in part to its objectivity, React is arguably the most well-liked JavaScript library for making user interfaces.","breadcrumb":{"@id":"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/studysection.com\/blog\/react-reactjs-module-design-pattern\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/studysection.com\/blog\/"},{"@type":"ListItem","position":2,"name":"React \/ ReactJS &#8211; Module Design Pattern"}]},{"@type":"WebSite","@id":"https:\/\/studysection.com\/blog\/#website","url":"https:\/\/studysection.com\/blog\/","name":"Blog Posts on famous people, innovations and educational topics","description":"","publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/studysection.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/studysection.com\/blog\/#organization","name":"StudySection","url":"https:\/\/studysection.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","contentUrl":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","width":920,"height":440,"caption":"StudySection"},"image":{"@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/studysection","https:\/\/twitter.com\/studysection","https:\/\/www.instagram.com\/study.section\/","https:\/\/www.linkedin.com\/company\/studysection"]},{"@type":"Person","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402","name":"admin-studysection-blog","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","caption":"admin-studysection-blog"},"url":"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/"}]}},"views":337,"_links":{"self":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/6247"}],"collection":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/comments?post=6247"}],"version-history":[{"count":5,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/6247\/revisions"}],"predecessor-version":[{"id":6253,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/6247\/revisions\/6253"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media\/6248"}],"wp:attachment":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media?parent=6247"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/categories?post=6247"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/tags?post=6247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}