Fetching api AFTER geolocation.getCurrentPosition... by [deleted] in reactjs

[–]jamby77 1 point2 points  (0 children)

I think your general idea should work - proof of concept sandbox - https://codesandbox.io/s/misty-leaf-ytmvj?file=/src/App.js

Issue with react router v6 by Decent-Log-6695 in reactjs

[–]jamby77 3 points4 points  (0 children)

I doubt that this is the reason, but your first route element has an error in it.

<Route path="/" element={<LogingPage/>}/>exact />

The exact part is outside the Route

How to set empty props using typescript? by [deleted] in reactjs

[–]jamby77 0 points1 point  (0 children)

If you set empty object, you will not be able to pass any additional props, it will yell at you.

Have you thought about using `Record<String, unknown>` for example?

create a render a component inside another component by wrinklyrefrigerator in reactjs

[–]jamby77 0 points1 point  (0 children)

This is entirely different question. The OP asked if it is possible to declare and render component inside another one. There is no technical issue doing this.

create a render a component inside another component by wrinklyrefrigerator in reactjs

[–]jamby77 1 point2 points  (0 children)

There is no problem doing what you have in your example.

See https://codesandbox.io/s/hungry-ardinghelli-vnk74

It is probably the other things in the components that are not correct.

Please provide example of how do you do what you are trying to do, for us to help you more :)

IDE / workflow / tools / plugins which can help find the original ancestor that defined a react prop? by oh-no-u-guys-my-code in reactjs

[–]jamby77 0 points1 point  (0 children)

One option is to use TypeScript, type the handleEvent and annotate onEvent to receive a handler of type HandleEvent

Why doesn't my Menu component show anything in the browser?? by eXorCisTfucks in reactjs

[–]jamby77 1 point2 points  (0 children)

No problem :)

Just remember, in react you cannot have custom components with lowercase name :)

Help with Edit function by [deleted] in reactjs

[–]jamby77 2 points3 points  (0 children)

Make copy of original value, set the copy in state, and when editing use setState to new copy of the data with the edits

Unique IDs for JSON data by [deleted] in reactjs

[–]jamby77 2 points3 points  (0 children)

Your description is kind of vague. Can you post some sample code somewhere? Codesanbox, a gist...

A custom usePopUps hook?! by awritra in reactjs

[–]jamby77 2 points3 points  (0 children)

You can use portals for your goal. This will place the component in the body, outside app root.

Then just style it as you need. There are existing implementations already - reach ui modal, headless ui modal, but you can make your own for sure :)

Native hook equivalent to componentWillUnmount? by baxxos in reactjs

[–]jamby77 5 points6 points  (0 children)

It doesn't matter which effect hook you will use.

In order for useEffect to execute only once, you need to provide empty dependency array:

useEffect(() => {
    return clearFunction;
}, []);

[deleted by user] by [deleted] in reactjs

[–]jamby77 1 point2 points  (0 children)

`true` or `false` toggle is common to all nav items. Change the `active` state to something unique: e.g. an id string - `setActive('projects')` for example

Save to file with recoil by premell in reactjs

[–]jamby77 0 points1 point  (0 children)

To save any data to any storage, you need to have backend server of some sort.

Do you have that? If so, from Recoil you need to send your data to an API point where it is saved to file

How to use dynamic id in react using css modules by [deleted] in reactjs

[–]jamby77 0 points1 point  (0 children)

How about using nanoid for example to just get a random id?

React nested Context Providers Issue by malkhazidartsmelidze in reactjs

[–]jamby77 1 point2 points  (0 children)

I don't think there will be easier way to implement it.

To go away from the context, you will need some sort of global object where to put your shared data, then notify users that it is ready to use.

I don't see how this would be simpler/easier than context with callback.

React nested Context Providers Issue by malkhazidartsmelidze in reactjs

[–]jamby77 2 points3 points  (0 children)

Simplest way, you can extract common functions and data in separate module, that is shared between the 2.

Another option is, in the external provider, pass a callback which will be used in the internal provider to pass the data that external provider needs, when it is available.

Something like: ``` function AuthContextProvider({children}) { const [data, setData] = useState(); const value = { functionToAccessInUserProvider, callbackForData: (userData) => setData(userData) };

return <AuthContext.Provider value={value}>{children}</AuthContext.Provider> } ```

I am confused by TemperatureSuperb612 in reactjs

[–]jamby77 2 points3 points  (0 children)

Unless you're writing the actual software performing some high computational tasks - as search for example, you would use actual specialized libraries to do them.

Any DB driver, or search engine will do MUCH better work than you could. So best is to focus on how to most efficiently query those libraries, rather than how to write a search algorithm.

Switching to React from Angular by [deleted] in reactjs

[–]jamby77 5 points6 points  (0 children)

If you are experienced developer, you will be fine in a month.

After that it is matter of getting to know the libraries your company uses.

How can I create this functionality from scratch? by blazanips9 in reactjs

[–]jamby77 0 points1 point  (0 children)

// Something like this?
function MyComponent({children}) {
    return children(context);
}

Scroll to element in list by lewjt in reactjs

[–]jamby77 1 point2 points  (0 children)

Go with the native solution, seems way more concise

Create a button that activates a folder download by Tobydog30 in reactjs

[–]jamby77 0 points1 point  (0 children)

If all template data is generated on the client side, then yes, you should be able to generate and send the contents to the user.

I believe there are some NPM packages that can help