- Published
- Author
- Mainak
test revalidate NEXT
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.
Pick Omit Partial NonNullable React.ComponentProps React.MouseEventHandler and special one React.PropsWithChildrenPropsWithChildren enables components to take both props and child elements as input.const Track = ({ children }:PropsWithChildren) => {
return (
{children}
);
};classnames, further conditions can be added depending on whether the initial condition is true or false.{icons &&
icons.map((icon: any, index: number) => {
return (
{icon.icon}
{icon.name}
);
})}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 falsecol-span-4 is added when the index is even, whereas the class col-span-3 is added when the index is odd.sx prop to add css to individual components without using styled or tailwind classes.npm install @mui/material @emotion/react @emotion/styledimport { Box, IconButton, Paper, Typography } from "@mui/material";sx prop. The sx prop allows us to use a superset of css classes making it very intuitive to use.React.ChildrenReact.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.React.Children.count(children)children, equal to the number of times that a callback passed to map or forEach would be invokedReact.cloneElement() function. This can be used when a parent component wants to add or change the props of its children.React.cloneElement(element, [props], [...children])element and returns an element with the desired changes. We can further pass props to it as well.CLS i.e Cumulative Layout Shift a metric used to quantify the stability of the content on a website when it loads. Normally a layout Shift occurs whenever any element on the web page changes it position unexpectedly.CLS:-Index name 'index_external_reservation_airport_transfers_on_external_reservation_id' on table 'external_reservation_airport_transfers' is too long; the limit is 63 characterst.references :external_reservation, null: false, foreign_key: true, index: {:name => 'idx_external_reservation_airport_transfers_external_reservation'}Showing 49 to 51 of 82 results
Codemancers can bring your vision to life and help you achieve your goals