<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[webdevsum - Medium]]></title>
        <description><![CDATA[Quick summaries of basic concepts in web development. - Medium]]></description>
        <link>https://medium.com/webdevsum?source=rss----d94e2142b80b---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>webdevsum - Medium</title>
            <link>https://medium.com/webdevsum?source=rss----d94e2142b80b---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 06:28:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/webdevsum" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[React Hooks Summarised]]></title>
            <link>https://medium.com/webdevsum/react-hooks-summarised-ca11f6a63f87?source=rss----d94e2142b80b---4</link>
            <guid isPermaLink="false">https://medium.com/p/ca11f6a63f87</guid>
            <category><![CDATA[hooks]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Mitchell Bryson]]></dc:creator>
            <pubDate>Thu, 16 Feb 2023 12:44:54 GMT</pubDate>
            <atom:updated>2023-02-16T12:44:54.713Z</atom:updated>
            <content:encoded><![CDATA[<p>React hooks are functions that allow you to use state and other React features in functional components, which were previously only available in class components. React hooks were introduced in React 16.8 and have since become an important part of React development.</p><p>Here is a list of React hooks available:</p><p>useState: The useState hook is used to manage state in functional components. It takes an initial state value and returns an array with two elements: the current state and a function to update the state.</p><pre>import { useState } from &#39;react&#39;;<br><br>function Example() {<br>  const [isActive, setIsActive] = useState(false);<br>  function handleClick() {<br>    setIsActive(!isActive);<br>  }<br>  return (<br>    &lt;button onClick={handleClick}&gt;<br>      {isActive ? &#39;Active&#39; : &#39;Inactive&#39;}<br>    &lt;/button&gt;<br>  );<br>}</pre><p>useEffect: The useEffect hook is used to handle side effects, such as fetching data or manipulating the DOM, in functional components. It takes a function that is executed after every render and an optional array of dependencies that determine when the effect should be re-run.</p><pre>import { useEffect } from &#39;react&#39;;<br><br>function Example() {<br>  useEffect(() =&gt; {<br>    document.title = &#39;New Title&#39;;<br>  });<br>  return &lt;div&gt;Example&lt;/div&gt;;<br>}</pre><p>useContext: The useContext hook is used to consume a React context in a functional component. It takes a context object created with the createContext function and returns the current value of the context.</p><pre>import { useContext } from &#39;react&#39;;<br>import ThemeContext from &#39;./ThemeContext&#39;;<br><br>function Example() {<br>  const theme = useContext(ThemeContext);<br>  return &lt;div style={{ color: theme.color }}&gt;Example&lt;/div&gt;;<br>}</pre><p>useReducer: The useReducer hook is an alternative to useState for managing more complex state. It takes a reducer function and an initial state value, and returns the current state and a dispatch function to update the state.</p><pre>import { useReducer } from &#39;react&#39;;<br><br>function reducer(state, action) {<br>  switch (action.type) {<br>    case &#39;INCREMENT&#39;:<br>      return state + 1;<br>    case &#39;DECREMENT&#39;:<br>      return state - 1;<br>    default:<br>      return state;<br>  }<br>}<br>function Example() {<br>  const [count, dispatch] = useReducer(reducer, 0);<br>  function handleIncrement() {<br>    dispatch({ type: &#39;INCREMENT&#39; });<br>  }<br>  function handleDecrement() {<br>    dispatch({ type: &#39;DECREMENT&#39; });<br>  }<br>  return (<br>    &lt;div&gt;<br>      &lt;button onClick={handleIncrement}&gt;+&lt;/button&gt;<br>      {count}<br>      &lt;button onClick={handleDecrement}&gt;-&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>useCallback: The useCallback hook is used to memoize a function, so that it only gets re-created if its dependencies change. This is useful when passing functions as props to child components.</p><pre>import { useState, useCallback } from &#39;react&#39;;<br><br>function Example() {<br>  const [count, setCount] = useState(0);<br>  const incrementCount = useCallback(() =&gt; {<br>    setCount(count + 1);<br>  }, [count]);<br>  return &lt;button onClick={incrementCount}&gt;{count}&lt;/button&gt;;<br>}</pre><p>useMemo: The useMemo hook is used to memoize a value, so that it only gets re-computed if its dependencies change. This is useful for expensive calculations that don’t need to be re-done on every render.</p><pre>import { useMemo } from &#39;react&#39;;<br><br>function Example({ a, b }) {<br>  const result = useMemo(() =&gt; {<br>    return a * b;<br>  }, [a, b]);<br>  return &lt;div&gt;{result}&lt;/div&gt;;<br>}</pre><p>useRef: The useRef hook is used to create a mutable reference that persists between renders. This is useful for storing values that don’t trigger a re-render.</p><pre>import { useRef } from &#39;react&#39;;<br><br>function Example() {<br>  const inputRef = useRef(null);<br>  function handleClick() {<br>    inputRef.current.focus();<br>  }<br>  return (<br>    &lt;div&gt;<br>      &lt;input type=&quot;text&quot; ref={inputRef} /&gt;<br>      &lt;button onClick={handleClick}&gt;Focus Input&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>useLayoutEffect: The useLayoutEffect hook is similar to useEffect, but it runs synchronously after the DOM has been updated. This is useful for interacting with the DOM in a way that affects the layout of the page.</p><pre>import { useLayoutEffect, useState } from &#39;react&#39;;<br><br>function Example() {<br>  const [width, setWidth] = useState(0);<br>  useLayoutEffect(() =&gt; {<br>    function updateWidth() {<br>      setWidth(window.innerWidth);<br>    }<br>    window.addEventListener(&#39;resize&#39;, updateWidth);<br>    return () =&gt; window.removeEventListener(&#39;resize&#39;, updateWidth);<br>  }, []);<br>  return &lt;div&gt;Width: {width}&lt;/div&gt;;<br>}</pre><p>useImperativeHandle: The useImperativeHandle hook is used to expose a specific interface from a child component to its parent. This is useful when working with third-party libraries that require a specific interface.</p><pre>import { forwardRef, useImperativeHandle, useRef } from &#39;react&#39;;<br><br>const Child = forwardRef((props, ref) =&gt; {<br>  const inputRef = useRef(null);<br>  useImperativeHandle(ref, () =&gt; ({<br>    focus: () =&gt; {<br>      inputRef.current.focus();<br>    },<br>  }));<br>  return &lt;input type=&quot;text&quot; ref={inputRef} /&gt;;<br>});<br>function Example() {<br>  const childRef = useRef(null);<br>  function handleClick() {<br>    childRef.current.focus();<br>  }<br>  return (<br>    &lt;div&gt;<br>      &lt;Child ref={childRef} /&gt;<br>      &lt;button onClick={handleClick}&gt;Focus Input&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>useDebugValue: The useDebugValue hook is used to display a custom label in React DevTools for a custom hook. This is useful for debugging custom hooks.</p><pre>import { useDebugValue, useState } from &#39;react&#39;;<br><br>function useDoubleCount() {<br>  const [count, setCount] = useState(0);<br>  function increment() {<br>    setCount(c =&gt; c + 1);<br>  }<br>  useDebugValue(count * 2);<br>  return [count, increment];<br>}<br>function Example() {<br>  const [count, increment] = useDoubleCount();<br>  return (<br>    &lt;div&gt;<br>      &lt;div&gt;Count: {count}&lt;/div&gt;<br>      &lt;button onClick={increment}&gt;Increment&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca11f6a63f87" width="1" height="1" alt=""><hr><p><a href="https://medium.com/webdevsum/react-hooks-summarised-ca11f6a63f87">React Hooks Summarised</a> was originally published in <a href="https://medium.com/webdevsum">webdevsum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Components Summarised]]></title>
            <link>https://medium.com/webdevsum/react-components-summarised-69943b14b686?source=rss----d94e2142b80b---4</link>
            <guid isPermaLink="false">https://medium.com/p/69943b14b686</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[components]]></category>
            <dc:creator><![CDATA[Mitchell Bryson]]></dc:creator>
            <pubDate>Thu, 16 Feb 2023 12:43:19 GMT</pubDate>
            <atom:updated>2023-02-16T12:43:19.495Z</atom:updated>
            <content:encoded><![CDATA[<p>Here’s a summary on how a typical React component is developed:</p><ol><li>Define the component: In React, a component is essentially a JavaScript function or class that returns JSX (a syntax extension for JavaScript). Define your component and give it a name that starts with a capital letter (convention in React).</li><li>Decide on the component’s state: The state of a component is essentially an object that holds data that the component can access and modify. Decide on what data your component will need to keep track of and add it to the state.</li><li>Render the component: In the render method of the component, return the JSX that will be rendered on the page. The JSX should be wrapped in parentheses and can include other components and HTML tags.</li><li>Pass data to the component: To pass data to a component, you can use props (short for properties). When you use a component, you can pass data to it through props. This data can be accessed in the component through the this.props object.</li><li>Handle events: In React, you can define event handlers to handle user interaction with the component. Add event handlers to your component by defining a method that will handle the event, and then using that method as a prop on the element that needs the event handler.</li><li>Update the state: When the user interacts with your component, you may need to update the component’s state. To do this, call the this.setState() method in the event handler, passing in the updated state object.</li><li>Lifecycle methods: React has several lifecycle methods that allow you to control what happens during different stages of a component’s lifecycle. You can use these methods to do things like fetch data from an API, update the component’s state, and clean up after the component is unmounted.</li><li>Export the component: Finally, export your component so that it can be used in other parts of your application.</li></ol><p>This is a very basic overview of how a typical React component is developed. The actual process may vary depending on the specific requirements of the component and the application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69943b14b686" width="1" height="1" alt=""><hr><p><a href="https://medium.com/webdevsum/react-components-summarised-69943b14b686">React Components Summarised</a> was originally published in <a href="https://medium.com/webdevsum">webdevsum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native Summarised]]></title>
            <link>https://medium.com/webdevsum/react-native-summarised-40bc4798ce2e?source=rss----d94e2142b80b---4</link>
            <guid isPermaLink="false">https://medium.com/p/40bc4798ce2e</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[native]]></category>
            <dc:creator><![CDATA[Mitchell Bryson]]></dc:creator>
            <pubDate>Thu, 16 Feb 2023 12:42:24 GMT</pubDate>
            <atom:updated>2023-02-16T12:42:24.684Z</atom:updated>
            <content:encoded><![CDATA[<p>React Native is a framework for building mobile applications using JavaScript and React. It allows developers to create high-quality, native mobile apps for iOS and Android using the same codebase. Here’s a brief summary of React Native development with some code examples:</p><p>Components: Like in React, React Native also relies heavily on components. React Native provides a set of core components like View, Text, and Image, as well as platform-specific components like StatusBar and ActivityIndicator. Here&#39;s an example of a basic component in React Native:</p><pre>import React from &#39;react&#39;;<br>import { View, Text } from &#39;react-native&#39;;<br><br>const App = () =&gt; {<br>  return (<br>    &lt;View&gt;<br>      &lt;Text&gt;Hello, world!&lt;/Text&gt;<br>    &lt;/View&gt;<br>  );<br>};<br>export default App;</pre><p>Styles: React Native provides a StyleSheet API for styling components. This API is similar to CSS, but uses JavaScript objects instead. Here&#39;s an example of a styled component in React Native:</p><pre>import React from &#39;react&#39;;<br>import { View, Text, StyleSheet } from &#39;react-native&#39;;<br><br>const styles = StyleSheet.create({<br>  container: {<br>    flex: 1,<br>    justifyContent: &#39;center&#39;,<br>    alignItems: &#39;center&#39;,<br>    backgroundColor: &#39;#fff&#39;,<br>  },<br>  text: {<br>    fontSize: 20,<br>    fontWeight: &#39;bold&#39;,<br>  },<br>});<br>const App = () =&gt; {<br>  return (<br>    &lt;View style={styles.container}&gt;<br>      &lt;Text style={styles.text}&gt;Hello, world!&lt;/Text&gt;<br>    &lt;/View&gt;<br>  );<br>};<br>export default App;</pre><p>Navigation: React Navigation is a popular library for handling navigation in React Native. It provides a simple API for creating stack, tab, and drawer navigators, as well as handling deep linking and custom transitions. Here’s an example of a stack navigator in React Navigation:</p><pre>import React from &#39;react&#39;;<br>import { createStackNavigator } from &#39;@react-navigation/stack&#39;;<br>import { NavigationContainer } from &#39;@react-navigation/native&#39;;<br>import HomeScreen from &#39;./screens/HomeScreen&#39;;<br>import DetailScreen from &#39;./screens/DetailScreen&#39;;<br><br>const Stack = createStackNavigator();<br>const App = () =&gt; {<br>  return (<br>    &lt;NavigationContainer&gt;<br>      &lt;Stack.Navigator&gt;<br>        &lt;Stack.Screen name=&quot;Home&quot; component={HomeScreen} /&gt;<br>        &lt;Stack.Screen name=&quot;Detail&quot; component={DetailScreen} /&gt;<br>      &lt;/Stack.Navigator&gt;<br>    &lt;/NavigationContainer&gt;<br>  );<br>};<br>export default App;</pre><p>API Integration: React Native provides a fetch API for making HTTP requests. It also supports third-party libraries like axios and superagent for more advanced HTTP requests. Here&#39;s an example of using fetch in React Native:</p><pre>import React, { useState, useEffect } from &#39;react&#39;;<br>import { View, Text } from &#39;react-native&#39;;<br><br>const App = () =&gt; {<br>  const [data, setData] = useState(null);<br>  useEffect(() =&gt; {<br>    fetch(&#39;https://jsonplaceholder.typicode.com/todos/1&#39;)<br>      .then(response =&gt; response.json())<br>      .then(json =&gt; setData(json))<br>      .catch(error =&gt; console.error(error));<br>  }, []);<br>  return (<br>    &lt;View&gt;<br>      &lt;Text&gt;{data ? data.title : &#39;Loading...&#39;}&lt;/Text&gt;<br>    &lt;/View&gt;<br>  );<br>};<br>export default App;</pre><p>These are just a few examples of what you can do with React Native. There are many more libraries and APIs available for building mobile apps using React Native.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40bc4798ce2e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/webdevsum/react-native-summarised-40bc4798ce2e">React Native Summarised</a> was originally published in <a href="https://medium.com/webdevsum">webdevsum</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>