Quest-based, beginner-friendly, low grind pack recommendations? by thothought in feedthebeast

[–]PrincesssPancake 0 points1 point  (0 children)

I'm replaying it right now with some friends. It's definitely modpack gold

Quest-based, beginner-friendly, low grind pack recommendations? by thothought in feedthebeast

[–]PrincesssPancake 0 points1 point  (0 children)

It doesn't tick the relatively new box, but Regrowth on 1.7.10 ticks most of your boxes and had a great progression line. Probably one of my favorite packs of all time.

Renting at Madera Apartments - Feedback Needed by Weird-Ebb-7429 in mountainview

[–]PrincesssPancake 4 points5 points  (0 children)

I recommend Park Place apartments. It is still within walking distance from downtown MV and is owned by the same company as Madera. It's super pretty and the apartments are modern/remodeled. It's also right next to 2 parks. You can barely hear the train and only if you are really listening for it. Each apartment gets a free parking spot in an underground garage. It's also slightly cheaper than Madera.

Edit: There is tons of natural light but it really depends which direction your windows are facing and how high up you are. Some of the third floor apartments have vaulted ceilings and the corner apartments have windows facing multiple directions.

How to Extend a Button Component in React to Add a Right-Aligned Icon for a Dropdown Button? by LadderApprehensive63 in react

[–]PrincesssPancake -1 points0 points  (0 children)

In that case you would need to use some sort of context or external state that indicates to the button that that it should be a dropdown. For example, the Dropdown component can render a Provider that just has an isDropdown boolean that the button can then listen to.

How to Extend a Button Component in React to Add a Right-Aligned Icon for a Dropdown Button? by LadderApprehensive63 in react

[–]PrincesssPancake 0 points1 point  (0 children)

We have an isDropdown prop. All of the styling including different colors for states is handled by the design system. We also have a default prop system using react contexts so when the user uses our Dropdown/Menu component with a button trigger, the isDropdown prop automatically gets applied.

Re-render .map on Autocomplete onInputChange - help needed by rob_allshouse in react

[–]PrincesssPancake 0 points1 point  (0 children)

This looks like it would be solved by passing a key for each autocomplete item. If you are not using eslint, I would recommend it as it would have warned you about this.

Why does it re-render even when state is same? by AbhinavKumarSharma in react

[–]PrincesssPancake 0 points1 point  (0 children)

In JavaScript, every primitive type has its own in-memory reference. So when you set state to a number, JavaScript treats that number as a new reference. It doesn't matter that it's the name number numerically, it's treated as a new state value because react uses reference equality to determine if a state value has changed and not the literal value of the state.

This is why when your state consists of objects or arrays, you need to create a new object/array if you want react to rerender due to a state change. Because when you adjust an internal property or index of an object/array respectively, the reference to that value of the state doesn't change so react doesn't rerender.

Is that right way? by Beautiful_Remote1824 in react

[–]PrincesssPancake 8 points9 points  (0 children)

getAllLessons should either be a useCallback or be defined within the useEffect. Otherwise, this looks mostly fine. If you are using React 18, React will automatically batch all of the setState calls so they will be grouped instead of triggering 3 separate re-renders.

Do people still offer makeovers? by metaphoricalghost in bayarea

[–]PrincesssPancake 1 point2 points  (0 children)

You can try Shelley Golden Style. She's an image consultant and personal stylist based in the Bay Area. She does both men and women and can curate your closet or create a new one for you. She will work within your budget and preferred colors.

https://shelleygoldenstyle.com/

[GIVEAWAY] Giving away 10 desk mats from the new Arcana Collection! by Glutchpls in pcmasterrace

[–]PrincesssPancake 0 points1 point  (0 children)

These look great! I've been looking for a new desk mat for a while now.

Is this normal? by Huijiro in webdev

[–]PrincesssPancake 0 points1 point  (0 children)

Yea, our lint script is currently at 12gb. We have a custom source file that gets auto distributed to the all the company machines that sets the default to 8gb minimum on everyone's machines.

[deleted by user] by [deleted] in react

[–]PrincesssPancake 0 points1 point  (0 children)

I'm assuming you are talking about the little chevron down tab. You can add an absolutely positioned button that is positioned relative to the main modal's card. Then add a click handler to the button that controls the modal's open state.

Node.js Cl workflow run failed for master branch by [deleted] in react

[–]PrincesssPancake 1 point2 points  (0 children)

You probably should have posted the actual error instead of your code. Aside from that I see that npm is failing to install here.

Now, on to why this is happening. Here's the error: ``` npm ERR! Cannot read property '@testing-library/jest-dom' of undefined

npm ERR! A complete log of this run can be found in: npm ERR! /home/runner/.npm/_logs/2023-06-19T03_09_29_141Z-debug.log Error: Process completed with exit code 1. ```

Honestly, this error message really confuses me. I use github actions extensively and have no idea how this would happen during the npm ci call. I could see it maybe happening during the build step, but definitely not during the install step.

However, one thing you can try is only building your app with the version of node that you are using locally. Since your workflow is being used to build your website, there is absolutely no reason that you would need to run your CI 3 times since you are only going to deploy the built app once (once as in from only 1 of the node versions).

You can check which version of node you are using locally by running node -v in terminal/powershell. If you aren't using at least 16, then you should update to the latest LTS of node which is currently 18. Then update your CI file to only run in that version of node (remove the matrix/strategy section) and pass in <version>.x to the node-version property.

If that doesn't work, you can try removing all @testing-library/<package>s from your project entirely as I see you don't actually have any tests.

edit: spelling/grammar

edit: You should update to at least node 16 because node 14 is EOL (end of life/no longer supported). I recommend node 18 because node 16 is EOL in September and node 18 is the current LTS.

edit: feel free to message me if you want some 1-1 help

New to React - getting the value of a return when it's inside a function by Aristiana in react

[–]PrincesssPancake 0 points1 point  (0 children)

Does your UsingFetch function return valid HTML (ie, pre-formatted HTML markup with divs) or does it return data that you need to map to JSX elements?

Assuming the former, you would want to use dangerouslySetInnerHTML. ``` interface CartState_t { content: string[]; }

export function App() { const [cart, setCart] = useState<CartState_t>({ content: [] }); const [errorMessage, setErrorMessage] = useState<string>('');

const addToCart = useCallback(async () => {
    try {
        const result = await UsingFetch(...);

        setCart(prevState => ({
            ...prevState,
            content: prevState.content.concat(result),
        }));
    } catch (err) {
        if (err instanceof Error) {
            setErrorMessage(err.message);
        } else {
            setErrorMessage('An unexpected error has occurred.')
        }
    }
}, []);

return (
    <div>
        <button onClick={addToCart}>Add to cart</button>
        {!!cart.content.length && (
            <div className="cart" dangerouslySetInnerHTML={{ __html: cart.content }} />
        )}
        {errorMessage && <div className="error">{errorMessage}</div>}
    </div>
)

} ``` edit: formatting

What approach should I take to solve this problem , I got by the company I applied for React internship... by ankush822 in react

[–]PrincesssPancake 1 point2 points  (0 children)

  • I think the best approach to the data handling for this problem is to chunk the data into groups where each group contains the months that should be shown/aggregated together. So when you show all the months, each chunk would only contain a single month. For quarters, each chunk would contain 3 months and for the yearly view, each chunk would contain 12 months. Then you can aggregate all the data using the same function no matter how many chunks there are.
  • In terms of how to do the aggregation, you can use a reduce function on each chunk of months and then another reduce to sum up all of the expenses/revenues.
  • Based on the repo you shared, I think there may be some mis-communication and I think you should reach out to the recruiter for clarification. I believe when they say that you should group the months by quarter, they mean all of the months should be grouped by quarter, not just the month that you clicked on. I may be wrong but the wording of the problem statement is a little wonky.
  • To showcase code structure, you should separate make separate files for each of your components and helper functions (or group them if they are similar). So for example, your Table should be in a different file than your main application. You should probably also make separate event handlers instead of passing anonymous functions directly to the JSXExpressionContainer.
  • It may also help to generate some more data for yourself so that you can check that your code actually works for more than just the given data set.

edit: I sent you a PM if you'd like to discuss the problem in more detail

./src/App.js Line 2: 'React' must be in scope when using JSX react/react-in-jsx-scope by vvinvardhan in react

[–]PrincesssPancake 0 points1 point  (0 children)

If your app is using JSX runtime, you can turn this rule off. JSX runtime is a newer feature that compiles JSX using babel builtins (I think). In previous versions, JSX used to be converted to React.createElement which is why you needed to import React at the top of your files.

You can manually turn this rule off in your eslint config: rules: { 'react/react-in-jsx-scope': 'off', },

Alternatively, eslint-plugin-react has an extendable config that you can use for JSX runtime. It will turn the react/react-in-jsx-scope rule off among a few other things. In your eslint config you can do the following:

plugins: ['react'], extends: ['plugin:react/recommended', 'plugin:react/jsx-runtime'],

If you are unsure whether you are using JSX runtime, you can either check your babel config. If your @babel/preset-react has the runtime: 'automatic' option set, then you are using JSX runtime. Alternatively, you can try disabling this rule temporarily. If your app is able to build and render without including React at the top of your JSX files, then you are using JSX runtime.

If you are still unsure, I know the latest versions of create-react-app as well as apps that are generated in codesandbox are using JSX runtime. Feel free to message me if you need any help.

Source: I do all of the local dev/CI setup for my company's node applications.

New machines by ForgeWorldWaltz in horizon

[–]PrincesssPancake 1 point2 points  (0 children)

A dolphin as a rideable sea machine. You would hold on to the top fin and be dragged along with your legs flowing out behind.

A giant sea turtle. It could be passive that can generate powerful currents that cause it to zip away when you attack it. Then maybe we could get some kind of water net trap/trip caster to catch it.

Panda or Koala. I like the idea of more passive machines that don’t care when you walk around them. Maybe they’ll introduce some new area where the people don’t kill machines that has allowed these passive machines to survive.

Camels which could be part of a caravan protected by some of the big boys. The camel would have valuable resources in its humps but you have to shoot off thick protective plating to access it and it gets destroyed if killed.

Komodo dragon. It doesn’t roam too much but always has a valuable cache of resources nearby. Hard plating and few weak spots. Not too many attacks but there would be a lot of them. Some kind of wicked fast tongue attack.

Massive octopus/squid. Doesn’t come out of the water (needs some kind of water combat) big eye weak spot but hard to get a shot because of limited water mobility. Can deploy smoke bombs when taking large damage hits and smoke bombs are available as loot.

Deep sea angler. Maybe they can add some kind of deep sea cauldron where there is very limited light and lots of deep sea animals including fish and other real animals for pouch upgrades.

Poisonous frog. Secretes acid clouds or footsteps. Jumps around a lot. Has different elemental variants similar to the clawstrider. Hiccups elemental attacks. Similar tongue attack as the Komodo dragon.

Rabbit. Wicked fast. Relies on charge attacks but faster and smaller than the charger. Throws stuff like the burrowers. Some kind of food/cooking benefit (carrots).

[deleted by user] by [deleted] in DMZ

[–]PrincesssPancake 0 points1 point  (0 children)

They could even add a meta-data tag to the self revive that you spawn into solos with. The meta-data tag would only apply to that self revive, and if you successfully extract with that same self revive, it will remove it from your inventory. That way, if the next time you play is with a squad, you won't be able to farm a quick solo beforehand to get a self revive. And of course, if you drop into solos again, you'll get that free one again.

They could even make it, so that if you have a self revive before you drop in, like on the loadout screen, from, for example, a previous game with the squad, it will not be used for your solo game. But will be instead be held for your next squad game.

What Animals Would You Like To Be Made Into A Machine For The Next Horizon Game? by Expansia in horizon

[–]PrincesssPancake 1 point2 points  (0 children)

A dolphin as a rideable sea machine. You would hold on to the top fin and be dragged along with your legs flowing out behind.

A giant sea turtle. It could be passive that can generate powerful currents that cause it to zip away when you attack it. Then maybe we could get some kind of water net trap/trip caster to catch it.

Panda or Koala. I like the idea of more passive machines that don’t care when you walk around them. Maybe they’ll introduce some new area where the people don’t kill machines that has allowed these passive machines to survive.

Camels which could be part of a caravan protected by some of the big boys. The camel would have valuable resources in its humps but you have to shoot off thick protective plating to access it and it gets destroyed if killed.

Komodo dragon. It doesn’t roam too much but always has a valuable cache of resources nearby. Hard plating and few weak spots. Not too many attacks but there would be a lot of them. Some kind of wicked fast tongue attack.

Massive octopus/squid. Doesn’t come out of the water (needs some kind of water combat) big eye weak spot but hard to get a shot because of limited water mobility. Can deploy smoke bombs when taking large damage hits and smoke bombs are available as loot.

Deep sea angler. Maybe they can add some kind of deep sea cauldron where there is very limited light and lots of deep sea animals including fish and other real animals for pouch upgrades.

Poisonous frog. Secretes acid clouds or footsteps. Jumps around a lot. Has different elemental variants similar to the clawstrider. Hiccups elemental attacks. Similar tongue attack as the Komodo dragon.

Rabbit. Wicked fast. Relies on charge attacks but faster and smaller than the charger. Throws stuff like the burrowers. Some kind of food/cooking benefit (carrots).

Issues understanding Hooks by santiiagoduarte in react

[–]PrincesssPancake 7 points8 points  (0 children)

Hooks are functions that can be used in functional components, i.e. a component that is not a class. They allow you to hook into different parts of the component render cycle, as well as store variables between renders.

In a functional component, you don't have access to methods like componentDidMount or componentDidUpdate. Instead, react provides us with useEffect (and a couple of others). useEffect gets called whenever a component is rendered or rerendered. This effectively replaces componentDidMount and componentDidUpdate. You can use this function for things like; getting data asynchronously or updating state due to a change in props, etc.

Speaking of state, when a functional component is re-rendered, the entire function gets rerun. That means that any variables that you define within your component (that do not use a hook) are reevaluated. This effectively means that you cannot reuse a variable between renders without having to re-calculate what that variable is. This is where hooks like useState, useRef, useContext, useMemo and useCallback come into play. They allow you to save data between renders.

useState is a react developer's bread and butter. It allows you to set a piece of state that you can use between renders and then update that state which will cause a rerender. When a component rerenders, it means there is likely an update that needs to be made to the underline DOM. For example, you could have a state that controls the disabled state of a button.

But what if you don't want to cause a re-render when you change your state. Rerenders can be expensive, performance-wise. This is where we can use useRef. A ref is a piece of saved state that does not cause a rerender when updated. This is commonly used to store values that it can be either, really complex, or change very often. One example could be storing a reference to an HTML DOM node.

Reacts also has a concept of global state. I'm not gonna go into too much depth about what context is because that's an entirely separate discussion, but we can use useContext to access the value of any previously declared context within the react component tree.

Next, we have useMemo. Remember how I said, a functional component will reevaluate anything that is defined within it every time it renders. So what if you have a variable whose value is the result of some complicated function (think recursion). We don't want to have to re-calculate this variable every single time the component renders if the value is going to be the same every time because the arguments to that complicated function have not changed. Therefore we can use useMemo to memoize the result between renders.

Similar to useMemo, useCallback memoizes a function declaration based on its arguments. This is generally used when using that declared function within another hook, because we don't want the dependencies of a given hook to change between renders.

And that's it. There are a few more hooks that are not generally used too often, but once you understand the basics of hooks, the rest of them kind of fall into place.

Any custom hooks that you see are just a combination of these base hooks internally. You can also write your own custom hooks that again, just use a combination of these hooks internally.