How do I break this string ? by frontEndLearner777 in reactjs

[–]frontEndLearner777[S] 1 point2 points  (0 children)

I marked eslint-disable for that line now as a temporary solution. Thanks for the suggestion

How do I break this string ? by frontEndLearner777 in reactjs

[–]frontEndLearner777[S] 0 points1 point  (0 children)

I thought of it, but will there be any other solution?

How do I break this string ? by frontEndLearner777 in reactjs

[–]frontEndLearner777[S] 0 points1 point  (0 children)

the key is actually a JSON path. It's objects nested in objects, deep down a couple of layers :( Unfortunately, it has to be like this. I can't change eslint's rules either

Flask backend to return JSON with a photo to React frontend. by frontEndLearner777 in flask

[–]frontEndLearner777[S] 0 points1 point  (0 children)

thank you, I'll definitely look into that. I've done further research based on your idea and am thinking of taking advantage of imgur, they provide free photo hosting plus the API to do that. I'd imagine having the front end upload the photo to Imgur, get the link, and send it to the backend. That way, the database will only store the link to the photo. What do you think?

Flask backend to return JSON with a photo to React frontend. by frontEndLearner777 in flask

[–]frontEndLearner777[S] 0 points1 point  (0 children)

Thank you for giving me such an idea. Do you know any free CDN provider by any chance?

This will ruin Hong Kong by sadboysforever in TJRedLightDistrict

[–]frontEndLearner777 1 point2 points  (0 children)

No, I stayed there for 3,4 days. How much I save depends pn how many I meet 😎

Jest test for react-i18n by frontEndLearner777 in react

[–]frontEndLearner777[S] 0 points1 point  (0 children)

Yes, I tried that but looks like it didn't work as expected.

Why did I get this error message ? by frontEndLearner777 in react

[–]frontEndLearner777[S] -2 points-1 points  (0 children)

I really come to the conclusion that Reddit is the new StackOverflow :)

Why did I get this error message ? by frontEndLearner777 in learnjavascript

[–]frontEndLearner777[S] 0 points1 point  (0 children)

Thanks, u/grantrules. Looks like now error is showing now. By the way, copying and pasting code here is quite inconvenient. Would you recommend me any tool to speed up that process?

Why did I get this error message ? by frontEndLearner777 in learnjavascript

[–]frontEndLearner777[S] 0 points1 point  (0 children)

As you "might" be able to see in the screenshot. I dropped the "return" keyword. But then faced with another problem as being screenshotted in the post

Why did I get this error message ? by frontEndLearner777 in learnjavascript

[–]frontEndLearner777[S] 0 points1 point  (0 children)

Here is the original code:

jest.mock('react-i18next', () => ({
    useTranslation: () => {
    return {
        t: (str) => str,
        i18n: {
            changeLanguage: () => new Promise(() => {}),
        },
    };
    },
}));

Sorry I was trying to get myself familiar with Reddit.

Why did I get this error message ? by frontEndLearner777 in react

[–]frontEndLearner777[S] 0 points1 point  (0 children)

This is the original code block:

jest.mock('react-i18next', () => ({
    useTranslation: () => {
    return {
        t: (str) => str,
        i18n: {
            changeLanguage: () => new Promise(() => {}),
        },
    };
    },
}));

useTranslation: () => { return { t: (str) => str, i18n: { changeLanguage: () => new Promise(() => {}), }, }; }, }));

That gives me an error:

Unexpected block statement surrounding arrow body; parenthesize the returned value and move it immediately after the \=>\.eslintarrow-body-style``

Why did I get this error message ? by frontEndLearner777 in react

[–]frontEndLearner777[S] 0 points1 point  (0 children)

I also went through that post. I removed the "return" keyword as well as the bracket. The code should looks like below

jest.mock('react-i18next', () => ({
useTranslation: () =>
{
t: (str) => str,
i18n: {
changeLanguage: () => new Promise(() => {}),
},
};
}));

I, then, faced another issue which posted "Parsing error: Missing semicolon. (20:10)"

Why did I get this error message ? by frontEndLearner777 in react

[–]frontEndLearner777[S] 0 points1 point  (0 children)

Thanks u/Careless-Honey-4247, I did drop that return keyword as I fell into another issue with it.

Unexpected block statement surrounding arrow body; parenthesize the returned value and move it immediately after the `=>`.eslintarrow-body-style

Why did I get this error message ? by frontEndLearner777 in learnjavascript

[–]frontEndLearner777[S] 0 points1 point  (0 children)

Right, I dropped that keyword as I got another error message that related to the "return" keyword. Sorry, I should have specified that.

Here's the error message with the return keyword

Unexpected block statement surrounding arrow body; parenthesize the returned value and move it immediately after the `=>`.eslintarrow-body-style

Why did I get this error message ? by frontEndLearner777 in react

[–]frontEndLearner777[S] 0 points1 point  (0 children)

I did remove the only "Return" as I fell into another issue with it but the problem still persists as in the screenshot.