Code Monkey home page Code Monkey logo

chai-aur-react's Introduction

ReactJS In-Depth Tutorial Series

Welcome to the comprehensive repository dedicated to teaching ReactJS in depth. This series covers not just the basics but dives deep into the intricacies of ReactJS to ensure that you emerge with a solid foundation and deep understanding of the most popular frontend library in the world.

๐ŸŒŸ Features

  • In-Depth Explanations: Each concept is broken down for easier understanding and comprehensive learning.
  • Project-Based Learning: Multiple projects to ensure that your theoretical knowledge is supplemented with practical experience.
  • Free Video Series: All lessons are available in video format on our YouTube channel "chai aur code".

๐Ÿš€ Getting Started

  1. Clone this repository:

    git clone https://github.com/hiteshchoudhary/chai-aur-react.git
  2. Navigate to each project folder and follow the instructions in the respective README to set up and run the project.

  3. Parallelly, watch the video lessons on the "chai aur code" YouTube channel for a detailed walk-through.

๐Ÿ“š Modules & Projects

  1. React JS RoadMap:

  2. Create react projects:

  3. Understand the react flow and structure:

  4. Create your own react library and JSX:

... (on going series)

๐Ÿ“– Additional Resources

๐Ÿ’ผ Contribution

Contributions are always welcomed. Feel free to raise issues or send in pull requests. Please do not update the existing code as users when they watch videos, they expect same code in repo.

๐Ÿ“บ "chai aur code" on YouTube

Don't forget to subscribe to "chai aur code" on YouTube for the entire video series and much more!

๐Ÿ™ Acknowledgements

A big thank you to the React community, Open Source contributors, and all the students and professionals who've provided their feedback and support to make this series better!


Happy Learning! โœจ


Made with โ˜•๏ธ by HiteshChoudhary

chai-aur-react's People

Contributors

hiteshchoudhary avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chai-aur-react's Issues

Auth Slice userData needs to be removed.

In authSlice.js
login: (state, action) => {
console.log(state , action)
state.status = true;
state.userData = action.payload.userData;
},
to
login: (state, action) => {
console.log(state , action)
state.status = true;
state.userData = action.payload;
}

as we are getting all the details in payload object their is no such key as userdata.

Post upload error

image

when i add image and submit it shows bellow error
image

import React, { useCallback, useEffect } from 'react'
import { useForm } from 'react-hook-form'
import { Button, Input, Select, RTE } from '../index'
import databaseService from '../../appwrite/database'
import { useNavigate } from 'react-router-dom'
import { useSelector } from 'react-redux'

function PostForm({ post }) {
const { handleSubmit, register, watch, setValue, control, getValues } = useForm({
defaultValues: {
title: post?.title || "",
slug: post?.$id || '',
content: post?.content || '',
status: post?.status || 'active'
}
});

const navigate = useNavigate()
const userData = useSelector((state) => state.auth.userData)

const submit = async (data) => {
    if (!post) {
        const file = await databaseService.fileUpload(data.image[0]);

        if (file) {
            const fileId = file.$id;
            data.featuredImage = fileId;
            const dbPost = await databaseService.createPost({
                ...data,
                userId: userData.$id,
            });
            if (dbPost) {
                navigate(`/post/${dbPost.$id}`)
            }
        }
    } else {
        const file = data.image[0] ? await databaseService.fileUpload(data.image[0]) : null;

        if (file) databaseService.deleteFile(post.featuredImage)

        const dbPost = await databaseService.updatePost(post.$id, {
            ...data,
            featuredImage: file ? file.$id : undefined,
        });

        if (dbPost) {
            navigate(`/post/${dbPost.$id}`)
        }
    }
}

const slugTransform = useCallback((value) => {
    if (value && typeof value === 'string') {
        return value
            .trim()
            .toLowerCase()
            .replace(/^[a-zA-Z\d\s]+/g, '-')
            .replace(/\s/g, '-')
    } else return ''
}, [])

useEffect(() => {
    const subscription = watch((value, { name }) => {
        if (name === 'title') {
            setValue('slug', slugTransform(value.title), { shouldValidate: true })
        }
    })
    return () => subscription.unsubscribe()

}, [watch, slugTransform, setValue])

return (
    <form onSubmit={handleSubmit(submit)} className='flex flex-wrap'>
        <div className="w-2/3 px-2">
            <Input
                label='Title: '
                placeholder='Title'
                className='mb-4'
                {...register('title', {
                    required: true
                })}
            />
            <Input
                label='Slug: '
                placeholder="Slug"
                className='mb-4'
                {...register('slug', {
                    required: true
                })}
                onInput={e => {
                    setValue('slug', slugTransform(e.currentTarget.value), { shouldValidate: true })
                }}
            />
            <RTE label='Content: ' name='content' control={control} defaultValue={getValues('content')} />
        </div>

        <div className="w-1/3 px-2">
            <Input
                label='Featured Image: '
                type='file'
                className='mb-4'
                accept='image/png, image/jpg, image/jpeg, image/gif'
                {...register('image', { required: !post })}
            />
            {post && (
                <div className="w-full mb-4">
                    <img src={databaseService.filePreview(post.featuredImage)} alt={post.title} className='rounded-lg' />
                </div>
            )}

            <Select
                options={['active', 'inactive']}
                label="Status"
                className='mb-4'
                {...register("status", { required: true })}
            />

            <Button type='submit' bgColor={post ? 'bg-green-500' : undefined} className='w-full'>{post ? 'Update' : 'Submit'}</Button>
        </div>
    </form>
)

}

export default PostForm

my post is stored in appwrite's storage but i cannot see it on my website

when i click on all post
my console show me this
image

here is my github repo can you please check it for any error.
https://github.com/prince-sunsara/ReactJS-Learning/tree/main/12_react_appwrite

06currencyconverter issue resolved

  • Required "setFrom" instead of "setAmount" for "onCurrencyChange".
  • Required "to" instead of "from" for "selectCurrency".
setFrom(currency)} selectCurrency={from} onAmountChange={(amount) => setAmount(amount)} />
setTo(currency)} selectCurrency={to} amountDisable />

ISSUE: Inefficient placement of api call in Allpages.jsx

Blog application / Allpages.jsx

screenshot

Here , appwriteService .getPosts() is called outside the useEffect block , that will rerun on all the rerenders of the component , instead it should be placed inside the useEffect to prevent uneccessary requests to the server .

After refreshing page getting logout

when i do login and inside dashboard when i refresh page it gets automatically logout, we need to store redux login data on localstorage so that data will be persist even after refresh.

Bug solved in 06currencyconverter

sir,
There is a bug in the 69th line in src < App.jsx

Actually, the line will be,
selectCurrency={to}
but mistakenly it was written by you like this,
selectCurrency={from}

after solving this, when we swap the values the currency on both sides will swap too.

note : There are strong chances that I might be wrong in my logic. so please guide me If I am wrong.

Issue In the Blog Application [Specifically Login - due to Appwrite Version Update]

This is for the Students following the tutorial, but using the 15.0.0 Version of Appwrite

The Appwrite Package has been Updated to Version 15.0.0
this project was created at the Version 13.0.0

So there was a slight change in the Documentation

for 12MegaBlog/src/appwrite/auth.js line 33
there will be a updation of the fucntion name
From

this.account.createEmailSession(email, password);

To

this.account.createEmailPasswordSession(email, password);

Bug: Incorrect State Update Function in InputBox Component

There is an error in the App.js file where the InputBox component's onCurrencyChange prop incorrectly uses setAmount instead of setFrom. This causes the amount to be set rather than updating the currency. This needs to be corrected to ensure the currency selection updates properly.

Steps to Reproduce:

  • Clone the repository and set up the project.
  • Run the application.
  • Navigate to the section where the "From" currency input is located.
  • Try changing the currency in the "From" field.

Expected Behavior:

When the currency is changed in the "From" input, the setFrom state update function should be called to update the currency.

Actual Behavior:

The setAmount state update function is called instead, which incorrectly updates the amount rather than the currency.

Code Snippet:

Here is the specific part of the code with the error and the proposed fix:

<InputBox
    label="From"
    amount={amount}
    currencyOptions={options}
    onCurrencyChange={(currency) => setFrom(currency)} // Corrected function
    selectCurrency={from}
    onAmountChange={(amount) => setAmount(amount)}
/>

useEffect is not used in all post

in our all-post-form we are not using useEffect, not using this hook web xhr request are in loop there is need to use the useeffect, as per my opinion.

Query Regarding Error in MegaBlog Code

Dear Hitesh Choudhary Sir,

I hope this message finds you well.

I am writing to seek your assistance regarding an issue I am encountering with the MegaBlog code. When I run the code, it directly opens the login page. After logging in, I can upload an image without any problem. However, if I log out and then log in again with the same email and try to post, the following error appears in the console:

arduino
Copy code
PostForm.jsx:43 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '$id')
at submit (PostForm.jsx:43:93)
at async react-hook-form.js?v=80acb06b:1557:7
I have also tried using your code, but the same problem persists.

Could you please provide guidance on how to resolve this issue? Any insights or suggestions would be greatly appreciated.

Thank you for your time and assistance.

Best regards,
[Your Name]
[Your Contact Information]

Counter goes negative && Incorrect exchange

onChange={(e) => onAmountChange && e.target.value!=0 && onAmountChange(Number(e.target.value))}

To convert currency accurately multiply the amount by the exchange rate from the source currency currencyInfo[from] to the target currency currencyInfo[to].
const convert = () => {
setConvertedAmount( (amount * currencyInfo[from] ) * currencyInfo[to])
}

optimised bg changer

in bg changer, there are only 4 colors still the code looks bulky and we need to manually do the copy-paste and change of color to different places instead, we can use component to shorten our code

Bug in Password Generator

Hey @hiteshchoudhary,
I was going through the algorithm you used for the password generator project and found a minor bug there.

Even after I select numbers or characters, there is still a possibility that the password won't contain them as random indexes could be from the front only, even not the capital and small letters at the same time.

image

It could be fixed using a validation. Should I try to fix that?

backend issues

Failed to load resource: the server responded with a status of 400 ()
cloud.appwrite.io/v1/account/sessions/email:1

   Failed to load resource: the server responded with a status of 401 ()

cloud.appwrite.io/v1/account/sessions/email:1

   Failed to load resource: the server responded with a status of 401 ()

cloud.appwrite.io/v1/account:1

   Failed to load resource: the server responded with a status of 409 ()

2appwrite.js?v=cffb9ceb:854 Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.
(anonymous) @ appwrite.js?v=cffb9ceb:854
Show 1 more frame
Show less
console.js:213 Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.

Appwrite Query Issue

appwrite_post_error
I want to fetch specific user's post but gotten issue in appwrites's query..
Here how I'm use the query to fetch the specific user's post...
async getPosts(userId){
console.log(userId);
try {
return await this.databases.listDocuments(
conf.appwriteDatabaseId,
conf.appwriteCollectionId,
[Query.equal('userId', userId)]
)
} catch (error) {
console.log("Appwrite::configservice::getPosts::error ", error);
return false;
}
}

Issue in Password generator project

In pass generator project when u click on number checkbox their is a chance where u didn't get any number in your password because their is low probability of number they are just 0-9 .
Passgen_Issue

06currencyConvertor

#31 So,basically the setTo and the setFrom in the App.jsx are not correct

BEFORE EDIT
Screenshot 2023-11-06 231654
Screenshot 2023-11-06 231717

AFTER EDIT

Screenshot 2023-11-06 231806
Screenshot 2023-11-06 231739

// JUST WANT PERMISSION TO PULL

AppWrite account scope issue

appwrite issue
This account scope issue not resolved even after adding a web platform on appwrite console..Need help to resolve this..

currency-converter - Bug Fix (Incorrect Prop Update in <InputBox> Component)

### - Issue: Incorrect State Update on Currency Change

There is an issue with the component in the code where the onCurrencyChange prop is incorrectly updating the amount state instead of the currency state. This causes the amount to be updated instead of the selected currency when the currency is changed.

current code -

<InputBox
    label="From"
    amount={amount}
    currencyOptions={options}
    onCurrencyChange={(currency) => setAmount(amount)}
    selectCurrency={from}
    onAmountChange={(amount) => setAmount(amount)}
/>

The issue lies in the onCurrencyChange prop:
onCurrencyChange={(currency) => setAmount(amount)}

The onCurrencyChange prop should correctly update the currency state.
The corrected code should be -

<InputBox
    label="From"
    amount={amount}
    currencyOptions={options}
    onCurrencyChange={(currency) => setFrom(currency)}
    selectCurrency={from}
    onAmountChange={(amount) => setAmount(amount)}
/>

Editing and saving one todo clears input fields of other todos

In todo project (located in 10todocontextLocal/src/App.jsx) location I've noticed an issue with the input fields of todo items. When editing and saving one todo item, the input fields of other todo items are unexpectedly cleared. This problem seems to come from how todos are updated in the updateTodo function within the App.jsx file. I would appreciate any assistance in resolving this issue. Thank you!

๐Ÿ› ๏ธ Currency API Problem Solutions ๐Ÿ› ๏ธ

  1. Correct URL Format:
    Make sure you are using the correct URL format to access the API. The format should be:
    https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/usd.json

  2. Dynamic Currency Code:
    You can dynamically change the currency code to get rates for different currencies. For example:
    ${currency} instead of usd

  3. Fallback Mechanism:
    If the primary URL fails, use the fallback URL provided by the maintainer:
    https://github.com/fawazahmed0/exchange-api

โœ… Now this API is working perfectly! You can change ${currency} instead of usd. ๐ŸŒ๐Ÿ’ฑ

โ“ Additional Troubleshooting Steps โ“

  • Check for Updates: Ensure you are using the latest version of the API.
  • Network Issues: Verify that there are no network issues preventing access to the API.
  • Rate Limits: Check if you have exceeded any rate limits set by the API provider.
  • API Documentation: Refer to the official API documentation for the latest updates and detailed information.

Originally posted by @AliGates915 in GitHub ๐Ÿ’ฌ

useReducer is not working in reduxToolkitTodo

import { configureStore } from "@reduxjs/toolkit";
import { todoSlice } from "../features/todo/todoSlice"; //Change the import

export const store = configureStore({
reducer: todoSlice.reducer, // Use todoSlice.reducer as the reducer
});

CurrencyType UI updation

on updating the currency type in currency options our UI does not show us the change currency type

Screenshot 2023-11-27 164632

slug

Hi sir thank you so much for solving our point in each step
whatever i am bcz of your videos but sir i was stuck in mega project (slug )
when i was try to use ID.unique(), its trows an error msg please once you get 2 min time plz sir solve my small issue

thank you sir

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.