Categories
General How-Tos Software Tech

Creating Custom React Hooks – Oyinkansola Odunsi

If you’re not new to React, you probably know about or have used hooks like useState and useEffect before. However, do you know that you can create your own hook? Yes, you heard that right! And this is what this article is about. 

Also, if you’re a newbie to JavaScript library, I’ve got you covered! I’ll bring you up to speed on the existing React hooks, and help you understand how to create yours. Let’s dive right in.

WHAT ARE REACT HOOKS?

The React library is commonly used because it’s easy to handle. One of this library’s excellent functionalities is React hooks. In simple terms, React hooks are JavaScript functions that allow you to access state and other React features without writing a class. 

These functions can also used to isolate the reusable parts of functional components. Additionally, they are identified by the word use, followed by the superpowers they possess like DebugValue, Effect, Callback, and LayoutEffect

THE EXISTING REACT HOOKS

The latest React version (version 18) has 15 built-in hooks that you can use. The most commonly used hooks are useState, useEffect, and useContext. Here is a list and a summary of all the existing React hooks:

  1. useCallback: Returns a memoized (stored to avoid repeated computation) callback function so that the child component that depends on the function will not re-render unnecessarily. The function will only be recreated if one of its dependencies changes.  
  2. useContext: After creating a context, useContext allows you to use a value in the context further down in your functional components. So, you don’t have to manually pass props down your component tree. 
  3. useDebugValue: Helps you label the output of your custom hooks so you can easily understand their state and monitor their behaviour in React DevTools.
  4. useDeferredValue: Useful for prioritizing the responsiveness of your user interface by deferring long-running operations that might affect the performance of your application.
  5. useEffect: This hook handles side effects in your functional components. Side effects include fetching data, setting up event listeners, and DOM manipulation. 
  6. useId: Helps you generate unique IDs across your React application.
  7. useImperativeHandle: Allows you to specify the properties of a component that should be exposed when using refs.
  8. useInsertionEffect: This makes it easy for you to execute a function after a component has been added to the DOM.
  9. useLayoutEffect: It works similarly to useEffect, but it’s synchronous. You can use it to make changes on your DOM immediately when it’s updated, and before the browser displays content on a user’s screen. 
  10. useMemo: It is used to memoize the result of expensive computations to avoid unnecessary recalculations.
  11. useReducer: Instead of using useState you can use useReducer to handle more complex state logic within a functional component.
  12. useRef: Helps you create mutable references that you can access across multiple renders of a functional component. 
  13. useState: Allows you to manage the state within a functional component.
  14. useSyncExternalStore: This hook allows you to read and subscribe to an external data store.
  15. useTransition: Helps you manage asynchronous updates to a React application’s UI.

WHY DO WE NEED CUSTOM HOOKS?

Don’t get me wrong, this article is not to say that the in-build React hooks are not sufficient. React has all these powerful hooks that will serve you well. Nonetheless, I can’t deny the reality that custom hooks can greatly improve the readability and overall quality of your code.

Let’s open up this fact a little bit by highlighting why you might need a custom hook:

  • It makes logic reusable.
  • It allows you to use other hooks provided by React.
  • You can easily separate your logic from your UI.
  • You can break down complex stateful logic into simple chunks of code that are easy to maintain.
  • You can test specific parts of your stateful logic because custom hooks can be debugged in isolation.

TIPS FOR CREATING CUSTOM REACT HOOKS

Here are some tips to keep in mind to ensure your custom hooks are flexible, reusable, and easy to understand.

  • Follow the naming convention by starting with use.
  • Repeated/reusable logic within your components should be your custom hooks candidates.
  • Feel free to use the built-in React hooks where necessary.
  • Make sure a hook is focused on one responsibility instead of multiple functions.
  • Your hooks should have value or functions that components can use.
  • Ensure your hooks can accept parameters so you can easily customize their behaviour.
  • Test your hooks in different scenarios to ensure they are performing as expected. You can use tools like Jest and/or the React Testing Library.
  • Document your hook and succinctly explain its function.

CREATING YOUR FIRST CUSTOM HOOK

Step 1: Define Your Hook

Let’s create a custom React hook that would allow our application toggle between light and dark mode (our reusable logic). To begin, we create a JavaScript file to define our hook.

import { useState, useEffect } from 'react';
function useDarkMode() {
  const [isDarkMode, setIsDarkMode] = useState(false);
  useEffect(() => {
    const body = document.body;
    if (isDarkMode) {
      body.classList.add('dark-mode');
    } else {
      body.classList.remove('dark-mode');
    }
  }, [isDarkMode]);
const toggleDarkMode = () => {
    setIsDarkMode(prevMode => !prevMode);
  };
  return [isDarkMode, toggleDarkMode]:
}
export default useDarkMode;

Step 2: Use Your Custom Hook

Now, we can use our custom hook in our React component.

import React from 'react';
import useDarkMode from './useDarkMode';
function App() {
  const [isDarkMode, toggleDarkMode] = useDarkMode();
  return (
    <div className="App">
      <button onClick={toggleDarkMode}>
        Toggle Dark Mode
      </button>
      <div className={isDarkMode ? 'dark-mode' : 'light-mode'}>
        {isDarkMode ? 'Dark Mode' : 'Light Mode'}
      </div>
    </div>
  );
}
export default App;

Step 3: Test Your Hook

To carry out the test, you’ll have to install the Jest and the React Testing Library using:

npm install --save-dev @testing-library/react @testing-library/jest-dom jest

Then, we’ll create a test file for our custom hook. Let’s call it useDarkMode.test.js.

We’ll proceed to use the renderHook and act utilities in our React Testing Library to test our hook.

import { renderHook, act } from '@testing-library/react-hooks';
import useDarkMode from './useDarkMode';


describe('useDarkMode', () => {
  test('should toggle dark mode correctly', () => {
    const { result } = renderHook(() => useDarkMode());
    // Initial state should be light mode (isDarkMode: false)
    expect(result.current[0]).toBe(false);
    expect(document.body.classList.contains('dark-mode')).toBe(false);
    // Toggle to dark mode
    act(() => {
      result.current[1](); // toggleDarkMode
    });
    expect(result.current[0]).toBe(true);
    expect(document.body.classList.contains('dark-mode')).toBe(true);
    // Toggle back to light mode
    act(() => {
      result.current[1](); // toggleDarkMode
    });
    expect(result.current[0]).toBe(false);
    expect(document.body.classList.contains('dark-mode')).toBe(false);
  });
});

Next, add Jest to your package.json file as follows, then run npm test to confirm that the useDarkMode hook is running as expected:

"scripts": {
  "test": "jest"
}

Step 4: Document Your Custom Hook

Document how your custom hook works and include details like its parameters and return values.

CREATING A DATA FETCHING CUSTOM HOOK

Now that you have an idea of how to create a custom React hook, let’s build another common custom hook (a data fetching hook) to further reinforce our knowledge. Shall we?

Step 1: Create the hook.

We’ll call it useFetch.js. This custom hook is commonly used to allow several components to fetch data from an API.

import { useState, useEffect } from 'react';


function useFetch(url) {
  const [data, setData] = useState(null);
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState(null);


  useEffect(() => {
    const fetchData = async () => {
      setLoading(true);
      try {
        const response = await fetch(url);
        if (!response.ok) {
          throw new Error('Network response was not ok');
        }
        const data = await response.json();
        setData(data);
      } catch (error) {
        setError(error);
  } finally {
        setLoading(false);
      }
    };
    fetchData();
  }, [url]);


  return { data, loading, error };
}
export default useFetch;

Step 2: Use your new hook in a component.

import React from 'react';
import useFetch from './useFetch';
function App() {
  const { data, loading, error } = useFetch('https://api.google.com/data');
  if (loading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;
  return (
    <div>
      <h1>Data:</h1>
      <pre>{JSON.stringify(data, null, 2)}</pre>
    </div>
  );
}
export default App;

Step 3: Test and document your custom hook.

import { renderHook } from '@testing-library/react-hooks';
import useFetch from './useFetch';
// Mock the fetch function
global.fetch = jest.fn(() =>
  Promise.resolve({
    ok: true,
    json: () => Promise.resolve({ data: 'mocked data' }),
  })
);
describe('useFetch', () => {
  afterEach(() => {
    fetch.mockClear();
  });
  it('should return data after fetch', async () => {
    const { result, waitForNextUpdate } = renderHook(() => useFetch('https://api.example.com/data'));
    expect(result.current.loading).toBe(true);
    await waitForNextUpdate();
    expect(result.current.loading).toBe(false);
    expect(result.current.data).toEqual({ data: 'mocked data' });
    expect(result.current.error).toBe(null);
  });
  it('should return an error if fetch fails', async () => {
    fetch.mockImplementationOnce(() =>
      Promise.reject(new Error('Fetch failed'))
    );
    const { result, waitForNextUpdate } = renderHook(() => useFetch('https://api.example.com/data'));
    await waitForNextUpdate();
    expect(result.current.loading).toBe(false);
    expect(result.current.error).toBe('Fetch failed');
    expect(result.current.data).toBe(null);
  });
});

GET STARTED TODAY

By leveraging the power of custom hooks, you’ll be able to write simple,  maintainable and readable codes. And trust me, once you get started, you are locked in by the ease these functions bring to your programming journey.

Categories
Best practices General Software Tech

How To Improve Your Website Accessibilty – Victoria Nduka

Have you ever noticed ramps beside staircases at building entrances, like the one in the image below? These ramps aren’t for aesthetics. They were designed to allow disabled individuals access to the building. Buildings with walkways structured like this are considered “accessible”, because they accommodate everyone, ensuring no one is left out.

Nowadays, a lot of interactions happen online. You can shop for groceries from the comfort of your home and get it delivered to you before the day is gone. Just like in physical spaces, our digital world needs to be accessible too. Digital accessibility means making sure websites and apps can be used by everyone.

WHAT IS WEB ACCESSIBILITY?

Web accessibility means designing and developing websites and apps to suit individuals of all kinds (disabled and abled). It ensures that users can perceive, understand, navigate, and interact with your digital content without experiencing challenges that may prevent users from accessing the information or services they need.

To understand how relevant web accessibility is in the digital world, let’s consider its importance:

  1. Legal Requirements: In countries like Israel and the United States of America, some laws and regulations require websites to be accessible. One of such law is the ADA (Americans with Disabilities) complaint law. Not complying with these regulations can lead to legal sanctions.
  2. Better User Experience: When navigation is easy to run through, text is readable, and the user interface is smooth, visitors to the site will have a user experience.
  3. SEO Benefits: Websites designed with accessibility in mind perform better in search engine rankings. Using descriptive text for images (alt text) and organizing content with appropriate heading levels help search engines understand and index your site more effectively.

ACCESSING YOUR CURRENT WEBSITE ACCESSIBILTY

Before making changes to your website’s accessibility, it’s important to
assess its current state. Here are some steps you can take to evaluate the accessibility of your website:

Step 1: Conduct an Accessibility Audit

You can use various tools and techniques to identify accessibility barriers and areas for improvement. Consider the following:

Automated Tools: Use automated accessibility testing tools like WAVE, Axe, or Lighthouse to scan your website for common accessibility issues. These tools identify issues such as missing alt text, colour contrast problems, and keyboard navigation issues
Manual Testing: While automated tools can catch many accessibility issues, some issues require manual testing. Manual testing involves simulating how users with disabilities might interact with your website and identifying any usability barriers they might encounter.
User Testing: You can take your audit a step further by conducting usability testing with individuals who have disabilities. Gather first-hand feedback on their experience using your website. This can provide valuable insights into real-world accessibility issues that automated tools may no

Step 2: Review Accessibility Guidelines

Familiarize yourself with the Web Content Accessibility Guidelines (WCAG) published by the W3C. These guidelines provide a comprehensive set of criteria for making web content more accessible to people with disabilities. Reviewing the WCAG can help you understand the
specific requirements and best practices for accessibility. Then you can determine in what areas your website is falling short.

Step 3: Identify Priority Areas

Once you’ve completed your accessibility audit and reviewed the WCAG, prioritize the accessibility issues you’ve identified. Focus on addressing critical issues that impact the largest number of users or present significant barriers to access. Consider factors such as the severity of the issue, frequency of occurrence, and the potential impact on users.

Step 4: Create an Accessibility Action Plan

Based on your assessment and prioritization, develop a comprehensive accessibility action plan outlining the steps you’ll take to address accessibility issues on your website. Set clear goals, timelines, and responsibilities for implementing accessibility improvements. Your action plan should be flexible and adaptable to accommodate new insights and changes in priorities.

Step 5: Monitor and Iterate

Accessibility is an ongoing process, not a one-time task. Once you’ve implemented accessibility improvements, continue to monitor your website regularly for new accessibility issues and feedback from users. Iterate on your accessibility action plan based on new insights and evolving accessibility requirements.

PRINCIPLES OF WEBSITE ACCESSIBILITY

The foundation of web accessibility lies in four key principles developed by the World Wide Web Consortium (W3C) in a set of guidelines known as the Web Content Accessibility Guidelines (WCAG). These principles, often abbreviated as POUR, form the framework for creating accessible digital experiences. Let’s explore each principle in detail:

  1. Perceivable (P): Perceivable means that users must be able to perceive the information being presented. In other words, the content must be available to at least one of their senses (sight, hearing, touch) so that
    they can access and understand it. Consequently, users with visual impairments, for example, must be able to access web content through other senses or enhanced visual means.
  2. Operable (O): Operable means that users must be able to navigate and interact with the interface. Users may use different ways to interact, like using a keyboard or talking to the device. So, no matter how a user wants to use the website or app, it should work smoothly and be easy to use.
  3. Understandable (U): Understandable means that users should easily understand what they see on the website or app and know how to use it. It requires using clear language and making sure things work in a way
    that users expect without feeling lost or frustrated.
  4. Robust (R): Robust means that your web content is accessible to everyone, regardless of their choice of devices. This includes users who rely on assistive technologies like screen readers, screen magnifiers, or voice recognition software. The robust principle also guarantees that content will remain accessible as technologies evolve.

IMPROVING YOUR WEBSITE USING THE P.O.U.R PRINCIPLE

Now that you’ve assessed your website’s current accessibility status, it’s time to take action to improve it. Let’s explore how you can apply the POUR principles we have discussed earlier to improve the accessibility of your website.

Perceivable (P)

  1. Text Alternatives: Images and multimedia should have text descriptions (alt text) that screen readers can read aloud. Avoid generic descriptions like “Image01.jpg” and write clear, concise text that describes the content of the image. For instance, an image of a dog
    would have an alt text like “Golden Retriever playing in the park.”
  2. Colour Contrast: People with visual impairments may struggle to distinguish between text and background colours if the contrast is poor. Use a colour contrast checker to ensure your text is readable against the background.
  3. Captions: Videos should have captions so that users who are deaf or hard of hearing can read what is being said.
  4. Transcripts: Audio content should have transcripts that provide a written version of the spoken material.

Operable (O)

  1. Keyboard Accessibility: People with motor impairments may have difficulty using a mouse or other pointing device to interact with a website. Ensure your website allows users to navigate through all interactive elements (menus, buttons, links, forms) using just the keyboard. Users should also be able to navigate through the entire site using the Tab key to move forward and Shift+Tab to move backwards.
  2. Seizure Prevention: Be mindful of content that flashes rapidly (more than three times per second) as it can trigger seizures in users with photosensitive epilepsy. Instead, consider using animations without rapid flashing or provide a warning along with the option to pause or stop them.
  3. Navigation Aids: Provide clear and consistent navigation options to help users find content. Use a consistent layout for navigation menus across all pages.

Understandable (U)

  1. Readable Text: Use clear and simple language. Break up text into manageable chunks with headings, lists, and other formatting. Avoid jargon and use short, straightforward sentences.
  2. Predictable Navigation: Ensure that navigation is consistent and predictable. Avoid sudden changes in context. Links should clearly state their destination and buttons should indicate their action.
  3. Input Assistance: Provide help and suggestions for form inputs. Show clear error messages and instructions. Use placeholder text and instructions within forms to guide users.

Robust (R)

  1. Standards Compliance: Use valid, semantic HTML and follow web standards to ensure compatibility with different browsers and assistive technologies. Use proper HTML5 elements and attributes.
  2. Accessible Rich Internet Applications (ARIA) Landmarks: Use ARIA landmarks to improve navigation for users with screen readers. Mark up sections of the page using ARIA roles like role=”banner”, role=”navigation”, and role=”main”.

YOUR NEXT STEP

Congratulations on taking the first steps towards enhancing the accessibility of your website! Improving the accessibility of your website is not just a good thing, it’s simply the right thing to do. Remember that improving your website accessibility is a journey, not a destination. As your
website grows and evolves, revisit these principles and make sure new content adheres to accessibility best practices.

Categories
Best practices Coaches General Hackathon

Tips For Winning A Hackathon Challenge

Hackathons are tools that drive creativity and innovation by tackling challenges to provide solutions. In a hackathon competition,  individuals with similar interests collaborate to deliver a solution to an existing or predicted problem. The hackathon organizers, sponsors, or partners usually outline the challenges and the judges decide the winners after the presented solutions, provided criteria and guidelines are met. It is an opportunity for creatives and innovative minds to leverage communication, teamwork, and presentation skills to solve problems and challenges quickly.

HOW HACKATHONS WORK

Hackathons are carried out online, onsite, or hybrid depending on the sponsor. When COVID-19 brought the world to a standstill in 2020 and different country-specific restrictions and measures were put in place, most hackathons were organized virtually. But in recent times, there has been a gradual return to fully onsite hackathons. 

The various technologies, tools, and challenges that participants can use and work on are announced 1–2 days before the hackathon begins. Partners and sponsors introduce the challenges to all participants including important information regarding the competition even if you don’t understand the challenge to work before coming, the explanations will dig deeper into them for you, so listen carefully.

Eventaully, each hackathon submission is judged by a metric to determine the winning team or solution. The success metric is measured differently depending on the organizers, judges, or themes. Common metrics used include quality of prototypes, minimum viable product(MVP) development, website functionality, improvement in engagement scores, reduction in implementation time, and Participation metrics.

TYPES OF HACKATHONS

Hackathons come in many forms and depend on the objective, goal, or sponsors. They all fall into one of the types listed below:

Niche/Theme Based: Niche or theme-based hackathons are specially crafted by single or multiple sponsors to provide solutions to challenges by using a specified or company-created tool and resource such as API. Common theme-based hackathons include Finance, Healthcare, Diversity, and Open Source. For instance,  Digital Healthcare is a hackathon focused on driving solutions to the healthcare sector. The required outcome could be to create a web application, video game, or anything significant.

Custom Hackathons: A hackathon is custom if it addresses solutions to problems by leveraging a language, framework, or profile. For instance, a hackathon that uses a programming language such as Java, Python, or Ruby on Rails to solve a problem. In this type of hackathon, how you use the programming language is preferred above what you can build. For profile-based hackathons, this involve student-only or female-only hackathons that accept only people in those categories as participants to work on challenges or topics to claim a reward.

MISTAKES YOU SHOULD NEVER MAKE DURING A HACKATHON

To succeed in a hackathon there are mistakes you should avoid. These mistakes are not bound to first-timers or amateurs alone but also applicable to experienced hackathon participants and previous winners of one or more hackathons.

  • Avoid changing teammates along the way or quickly selecting teammates based on their appearances, stickers on laptops, or gadgets. Doing this may jeopardize your team’s strength and efficiency since the competition is constrained by time.
  • Avoid using tools that you and your teammates are not familiar with. Hackathons are good places to learn new tools but do not try to build using a new tool without understanding the basics of that tool, it might not end well.
  • Avoid trying to build a solution that is too complex to be done within the stipulated time. You’d be requiring too much from your teammates.
  • Avoid allotting unreasonable time frames for the accomplishment of major product milestones.
  • Avoid working alone. Seek support from teammates, mentors, or sponsors when you have to.
  • Avoid imposing your opinions and thoughts on your teammates without considering other alternatives from their perspective.
  • Avoid prioritizing aesthetics over functionality.
  • The hackathon rules are very important and must be adhered to if you don’t want your team to be disqualified. Familiarize yourself with the hackathon’s rules and fundamental problem statements.
  • Do not repeat an already existing solution by modifying some features to wow the judges.

HOW TO WIN AN HACKATHON

Here are 10 tips for first timers, and experienced hackathon participants to ace any hackathon competition with ease

  • Have a complete team: Diverse your team skills and abilities to include developers, UI/UX designers, product/project managers, marketers, and those with social skills.
  • Teamwork is the key: Teamwork is important for winning a hackathon. Listen to the opinions of your teammates, appreciate their contributions and ideas, and be open generally to a variety of ways to achieve the same goal.
  • Apply empathy: Be kind enough to understand your teammates, and discover their strengths and weaknesses to coordinate your team, delegate properly and motivate each other.
  • Build only key components within the given time: Focus on building the key features the solution needs and distribute the most important features to your teammates, ensuring each team member knows what is to be built individually.
  • Focus on the hackathon 100%: Hackathons are filled with distractions demanding your attention. You must stay fixed on the solution you are building.
  • Appreciate the uniqueness of your solution: If you have a novel solution that you can pull off with the hackathon time frame then go for it and pay less attention to what other teams are building. Some might just be reinventing the wheel when there is no need.
  • Prepare your presentation: Invest ample time to work on your presentation, including your demo, and make it as simple and interactive as possible. Your presentation is the second most important part of the hackathon, after your solution. Highlight the problem statement, key features, and why you made the product, how it works, and how it solves the problems of the end users”. 
  • Document all the ideas: Write down the ideas, concepts, and complaints of each team member during the brainstorming session and use the Prioritization Matrix to pick between what is important and needed, important and not needed for the product.
  • Gather some information: Gather basic knowledge of your sponsors, judges, and audience to help you customize your presentation and demo to fit their needs. Use social media sites like LinkedIn, X, and Pinterest or strike up conversations at the hackathon during lunch or Q&A sessions.

WHERE TO FIND HACKATHON RESOURCES

If you have been having a hard time searching for hackathons, here are some resources for you to explore.

  • DevPost: DevPost is an epicenter for hackathons. It is stocked up with different types and categories of hackathons by level, length, theme, location, and status. You will also find guides, tricks, and tips for organizers and participants in hackathons.
  • NaijaHacks:  NaijaHacks is a go-to spot for all things on hackathons. It offers guides on team formation, mentors, prizes, and workshops. It also has tutorials broken down into sectors including Blockchain, VR/AR, Machine Learning,  Mobile/Web Development, Hardware, Miscellaneous, and an introduction to Git for beginners.
  • DoraHacks: This is the hub for Web3 hackathons, it features ongoing and upcoming hackathons to browse and participate in. Individuals and communities can also use their platform to host hackathons
  • Hackathons International: Hackathons International is a global organization that provides problem-solving strategies, toolkits, and resources for participants and organizers to host/successfully participate in hackathons globally.
  • GitHub: GitHub is a repository of hackathon projects and resources including tutorials, templates, code from past hackathons, and tools to help you practice your skills, and provide key tips to winning projects.  It is a good source of inspiration and insight into successful hackathon approaches. Typing “hackathon projects” into the search box on GitHub will return a curated list of hackathon resources.
  • Stack Overflow: If you are encountering a coding roadblock, this is your centre for solution. Stack Overflow is an online Q&A forum for experienced and beginner developers. It contains several solutions to common problems. Whatever you are struggle with, someone else has faced it before and shared a solution on the platform.  
  • API Docs: Application Programming Interface description documents include, tutorials, references, and examples that show and explain to developers what is possible with your API and how to use it. This depends on the hackathon theme or your project idea, you can leverage APIs from various platforms. Ensure to always refer to the official documentation for specific instructions and usage examples to be sure. You can check out Spotify documentation Spotify Web Documentation.

WHY YOU SHOULD PARTICIPATE IN A HACKATHON

Immediate Recruitment: Many participants in hackathons got jobs only by participating. Companies organize most hackathons to provide solutions to an existing problem or desire to launch a new product to target a market. The solution you build can come in handy, which can ultimately lead to you being recruited to continue the development of the solution.

Find out more: Due to the practical nature of hackathons, it provides a unique opportunity for beginners, intermediate, and experts to gain more experience and insights into a particular tool, application, or technology. For example, a participant may have theoretical knowledge of a programming language but may have yet to have the chance to apply it in a real-world project. By participating in a hackathon focused on that language, they can learn new techniques, best practices, and shortcuts from their peers.

Opportunity to Network: Hackathons attract a diverse group of participants, including students, professionals, entrepreneurs, and industry experts. Through team collaboration, workshops, and networking sessions, participants can forge valuable connections with people who share similar interests or work in related fields.

Build Technical and Problem-Solving Skills: Hackathons present participants with time-sensitive challenges that require innovative solutions. These challenges often span across a wide range of domains, from software development and data analysis to hardware prototyping and social impact projects. By tackling these challenges, participants can enhance their ability to think creatively, break down complex problems into manageable tasks, and adapt to unexpected obstacles.

Grow Your Social Skills: Hackathons foster a collaborative environment where participants must effectively communicate and work together to achieve their goals. Team members may come from different backgrounds, disciplines, or even countries, requiring them to bridge cultural and language barriers. Through brainstorming sessions, code reviews, and project presentations, participants can improve their verbal and written communication skills, as well as their ability to give and receive constructive feedback.

Launch a Career: Hackathons are real-world opportunities to meet your first and long-term mentors, business partners, and angel investors.  A hackathon is an opportunity to build a solution to a challenge that enables you to spot a market that is open to exploit creating a new career role for you.

Strengthen your Resume: Hackathon participation is highly regarded by employers as it demonstrates a candidate’s practical skills, creativity, and passion for learning. Including hackathon projects on a resume can showcase a candidate’s ability to work under pressure, collaborate with others, and deliver results within a limited timeframe. Moreover, winning a hackathon competition can further validate a candidate’s abilities and differentiate them from other job applicants.

Categories
Best practices General How-Tos

Open-source Contribution Guidelines

One of the easiest ways to convince recruiters to hire you is by showcasing a rich portfolio containing, at least, one open-source contribution project. For entry and junior developers (and maybe senior developers), this is not open for debate as the benefits of contributing to open-source projects are immense. Not only does contributing to open-source projects broaden your experience and skills, but it also provides an orifice of exposure to industry-standard tools and practices.

So, how do you get started?

FIND A PROJECT

The first step is to find an open-source project that interests you. You can start by exploring platforms like GitHub, GitLab, or Bitbucket. These platforms host millions of open-source projects of technologies and domains. Look for projects with a clear and active community, as this will make it easier to get started and receive support.

To find the right project, consider browsing trending repositories or searching for projects based on your interests. Many platforms offer tags or categories that can help you narrow down your search.

For example, if you’re interested in web development, you might search for projects tagged with “JavaScript” or “React.” If you’re into data science, look for projects involving “Python” or “Machine Learning”.

EVALUATE THE PROJECT

Before diving in, take some time to evaluate whether you want to contribute to the project. Consider factors such as:

Project Goals: Ensure the project’s goals align with your interests and objectives. Understanding the project’s mission and vision can help you stay motivated and make meaningful contributions.

Technology Stack: Check whether you’re familiar with the programming languages and tools used in the project. Contributing to a project using a stack you’re comfortable with can help you contribute more effectively and learn faster.

Community: Assess whether the community is active and welcoming to new contributors. An active community often means better support and more opportunities for collaboration. Look at the project’s issue tracker, pull request activity, and community forums or chat groups to gauge this.

READ DOCUMENTATION

Familiarize yourself with the project’s documentation. Most projects have detailed documentation that explains how the software works, how to set it up locally, and how to contribute to it. Reading the documentation will give you a good overview of the project’s architecture, coding standards, and contribution process.

Good documentation typically includes a README file with an introduction to the project, installation instructions, and a contribution guide. Some projects also have a Code of Conduct, which outlines the expected behavior of contributors. Pay attention to these documents as they provide essential information for new contributors.

FIND AN ISSUE TO WORK ON

After reading the documentation, it’s time to find an issue to work on. Most open-source projects use issue trackers to keep track of bugs, feature requests, and other tasks. Look for issues labeled as “good first issue” or “beginner-friendly” as these are usually suitable for newcomers. You can also filter issues based on your skill level, the type of task, or the programming language you’re comfortable with.

When selecting an issue, start with something small and manageable. This will help you get acquainted with the project’s workflow and build confidence. As you gain more experience, you can gradually take on more complex issues.

GATHER MORE INFORMATION

Once you’ve found an issue you’d like to work on, it’s essential to gather more information. Here are some steps you can take:

Read Comments and Discussions: Many issues have comments and discussions that provide additional context or clarify the problem. Reading through these can help you understand the issue better and avoid redundant efforts.

Ask Questions: If you have any doubts or need more information, don’t hesitate to ask questions in the project’s chat or forum. The project maintainers and other contributors will be happy to help you get started and provide guidance along the way.

Review Related Code: Sometimes, looking at related code or previous pull requests can provide insights into how similar issues were resolved. This can help you understand the coding standards and practices followed by the project.

WORK ON YOUR SOLUTION

With all the necessary information at hand, it’s time to start working on your solution. Here’s what you should do:

Fork the Repository: Fork the project’s repository to your own GitHub account. This creates a copy of the project where you can make changes without affecting the main codebase.

Create a New Branch: Create a new branch for your changes. It’s good practice to name your branch descriptively, such as “fix-issue-123” or “add-feature-x.”

Follow Coding Standards: Adhere to the project’s coding standards and conventions. This ensures that your code is consistent with the rest of the codebase and makes it easier for maintainers to review your changes.

Write Clear and Focused Code: Keep your changes focused and well-documented. Write clear commit messages that explain the purpose of each change. This helps maintainers understand your work and makes it easier to track changes.

SUBMIT YOUR SOLUTION

Once you’ve completed your solution, it’s time to submit it for review:

Create a Pull Request (PR): Create a pull request on the project’s repository. This notifies the maintainers that you’ve made changes and would like them to be reviewed and merged into the main codebase.

Describe Your Changes: In your pull request description, explain the problem you’re solving and the solution you’re proposing. Reference the issue you’re addressing and provide any relevant context or information.

Respond to Feedback: The project maintainers and other contributors will review your code, provide feedback, and help you make any necessary changes. Be open to feedback and willing to make revisions to improve your contribution.

Once your PR has been approved, your changes will be merged into the main codebase, and you’ll have made your first open-source contribution. Celebrate this milestone and take pride in your achievement.

ADDITIONAL TIPS

Be Patient and Open to Feedback: Open source projects often have many contributors and maintainers with different opinions and approaches. Be patient when waiting for feedback and open to constructive criticism.

Respect the Community: Adhere to the project’s Code of Conduct and respect the community guidelines. Maintaining a positive and respectful attitude fosters a welcoming environment for all contributors.

Keep Learning: Continuously improve your skills by learning from other contributors and exploring new technologies. The more you learn, the more valuable your contributions will become.

Ask for Help: Don’t be afraid to ask for help or clarification when needed. The open-source community is generally supportive and eager to assist newcomers.

Document Your Journey: Keep track of your contributions and document your learning process. This can be valuable for your personal growth and can also help you showcase your experience to potential employers.

Network with Other Contributors: Engaging with other contributors can lead to valuable connections and collaborations. Attend meetups, join community chats, and participate in discussions to expand your network.

Stay Updated: Open source projects are constantly evolving. Stay updated with the latest changes by following the project’s repository, joining mailing lists, or subscribing to newsletters. This ensures you are aware of new issues, features, and updates.

Contribute Beyond Code: Contributions to open-source projects are not limited to code. You can help by writing documentation, designing graphics, managing community events, or even translating content. These contributions are equally valuable and help the project thrive.

CONCLUSION

Contributing to open source projects is a rewarding experience that allows you to learn new skills, connect with other developers, and give back to the community. By following these simple steps, you can make your first contribution with confidence and start making a positive impact on the world of open source software.

Remember that every contribution, no matter how small, adds value to the project and the community. Whether you’re fixing a typo in the documentation, resolving a bug, or adding a new feature, your efforts are appreciated.