TILs - Fueling Curiosity, One Insight at a Time

At Codemancers, we believe every day is an opportunity to grow. This section is where our team shares bite-sized discoveries, technical breakthroughs and fascinating nuggets of wisdom we've stumbled upon in our work.

Published
Author
user-image
Syed Sibtain
System Analyst
Aliases in Graphql.
Let’s say we have a query that return us the cars Data. If we add both the queries, we will get an error.
Fields "cars" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.
UseCase Example:
👇This will throw error

Code

{  
  cars(filter: "name = Cars") {
    edges {
      node {
        name
        speed        
      }
    }
  }
  cars {
    edges{
      node{
        name
      }
    }
  }
}


👇This will work

Code

{  
  slowCars: cars(filter: "Cars") {
    edges {
      node {
        name        
      }
    }
  }
  fastCars: cars {
    edges{
      node{
        name
      }
    }
  }
}


It works because we are using aliases here. Aliases let us change the names of the data that is displayed in a query’s results. It is incredibly helpful when we need to fetch the same data using different filters.

Extra Resources: https://blog.logrocket.com/using-aliases-graphql/#:~:text=What%20are%20GraphQL%20aliases%3F,it%20according%20to%20your%20specifications.
Published
Author
user-image
Syed Sibtain
System Analyst
Aliases in Graphql.
Let’s say we have a query that return us the cars Data. If we add both the queries, we will get an error.
Fields "cars" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.
UseCase Example:
👇This will throw error

Code

{  
  cars(filter: "name = Cars") {
    edges {
      node {
        name
        speed        
      }
    }
  }
  cars {
    edges{
      node{
        name
      }
    }
  }
}


Published
Author
user-image
Mainak
test revalidate NEXT
Published
Author
user-image
Syed Sibtain
System Analyst
We have 7 different TypeScript utility types, like Pick Omit Partial NonNullable React.ComponentProps React.MouseEventHandler and special one React.PropsWithChildren

React's utility type PropsWithChildren enables components to take both props and child elements as input.

It is used in the definition of the component to identify the types of properties it can receive, including the children prop, which contains any elements contained within the component's JSX. In addition to children, it allows for the use of various props.

UseCase Example


TypeScript

const Track = ({ children }:PropsWithChildren) => {
  return (
    
      {children}
    
  );
};


Additional Resources: https://www.chakshunyu.com/blog/7-typescript-utility-types-for-react-developers/
Published
Author
user-image
Syed Sibtain
System Analyst
When using dynamic classnames, further conditions can be added depending on whether the initial condition is true or false.

Example:

JavaScript

{icons &&
   icons.map((icon: any, index: number) => {
      return (
         
                    {icon.icon}
                    
                      {icon.name}
                    
                  
                );
              })}


If the expression index % 2 (modulus) evaluates to true, the class name col-span-4 will be added. The second className which is col-span-3 and it is added if the expression !(index % 2) evaluates to true. However the ! mark changes the Boolean to false

So class col-span-4 is added when the index is even, whereas the class col-span-3 is added when the index is odd.
Published
Author
user-image
Vinaysripath
Using Material UI to create an interface, use the icons, buttons, layouts, navigation and other MUI components. Using the sx prop to add css to individual components without using styled or tailwind classes.
install MUI:

Code

npm install @mui/material @emotion/react @emotion/styled


import the suitable components:

Code

import { Box, IconButton, Paper, Typography } from "@mui/material";


simply use them like normal tags and add inline styles using the sx prop. The sx prop allows us to use a superset of css classes making it very intuitive to use.



Published
Author
user-image
Ayush Srivastava
System Analyst
React.Children

We can use the React.Children APIs to modify elements created by React before they’re rendered. It provides utilities for dealing with the this.props.children opaque data structure.

For example :-


Code

React.Children.count(children)


Returns the total number of components in children, equal to the number of times that a callback passed to map or forEach would be invoked
Published
Author
user-image
Vinaysripath
Using Material UI to create an interface, use the icons, buttons, layouts, navigation and other MUI components and adding styles using the sx prop.

Showing page 49 of 83

Your competitors are already using AI.
The question is how fast you want to unlock the value.

Don't know where to start?

AI is everywhere but it's unclear which investments will actually move your metrics and which are expensive experiments.

Your data isn't ready

Most AI projects fail at the data layer. Pipelines, quality, access all need work before LLMs can deliver value.

Internal teams are stretched

Your engineers are shipping product. They don't have capacity to also become AI specialists with production-grade experience.

Legacy systems block everything

Aging, undocumented codebases make AI integration slow, risky, and expensive. They need to move first.

Don't worry. We've got you covered.

Start with the audit.