React Flux: Routing with react-router-component
lessonDuration 5m 10s
By default, React doesn't have built in routing. We will add routing to our application with the react-routing-component.
Browse
Find courses, lessons, articles, talks, and podcasts.
1,542 results for "react"
Showing 673–696 · Page 29 of 65
lessonDuration 5m 10s
By default, React doesn't have built in routing. We will add routing to our application with the react-routing-component.
lessonDuration 5m 15s
Organizing modules and components is a critical aspect of the development of any single-page web application (SPA). In this lesson we will look at refactoring the Flux React store into a more module structure.
lessonDuration 9m 39s
In Flux our Components are referred to as Views, but they are the same familiar Components associated with any React development. In Flux, however, we have the benefit of the architecture to keep us from having to pass down through a long chain of children Components any functionality that may be embedded in our Stores. In this Lesson we will wire up all of our Components in record time utilizing the architecture we've already established.
lessonDuration 2m 58sFree
It can be tedious to type out all the boilerplate needed to get the DOM and states in [React](https://egghead.io/technologies/react) to synchronize. Luckily, React provides a version of the toolkit with a selection of available addons. This lesson is going to dig into ReactLink, and how this addon can give you two-way binding.
lessonDuration 9m 31sFree
Since React is only interested in the V (view) of MVC, it plays well with other toolkits and frameworks. This includes [AngularJS](https://egghead.io/technologies/angularjs) and [D3](https://egghead.io/technologies/d3).
lessonDuration 3m 24sFree
Mixins will allow you to apply behaviors to multiple React components.
course
Learn TypeScript in practical context with React examples!
lesson
It's fairly trivial to create a React project, but there's always a big hurdle between creating it locally and making it shareable so that someone else can run it. This lesson walks you through the process of automating creating a React project locally, creating the repository where it's going to be hosted, and creating shareable links where it can be run so that you can quickly and easily create single one-off demos and shoot them over to your friends and coworkers for sharing your code ideas in a working environment. ```bash share-react-project() { if [[ -z "$1" ]]; then echo "Usage: share-react-project <project_name>" return 1 fi local project_name="$1" local github_username=$(gh api /user --jq '.login') echo "Creating Vite project: $project_name" pnpm create vite "$project_name" --template react cd "$project_name" echo "Initializing Git repository" git init echo "Adding all files to Git" git add . echo "Creating initial commit" git commit -m "Initial commit" local codesandbox_link="https://codesandbox.io/p/github/${github_username}/${project_name}" echo "Adding CodeSandbox link to README.md" echo "" >> README.md echo "## CodeSandbox" >> README.md echo "[](${codesandbox_link})" >> README.md echo "Adding README.md to Git" git add README.md echo "Committing README.md changes" git commit -m "Add CodeSandbox link" echo "Creating GitHub repository: $github_username/$project_name" gh repo create "$github_username/$project_name" --public echo "Pushing to remote 'origin'" git push -u origin main echo "Project '$project_name' created successfully!" echo "GitHub repository: https://github.com/$github_username/$project_name" echo "CodeSandbox link: $codesandbox_link" } ```
lesson
[Shadcn](https://ui.shadcn.com/docs) is a popular component library that allows you to install components into your codebase. Learn how to install the [Table component](https://ui.shadcn.com/docs/components/table) and use that presentational component with [Tanstack table](https://tanstack.com/table/latest).
lessonDuration 4m 12sFree
For user signin, we'll implement a proper server action by creating a `actions.js` file where our server actions can live. In our login page, we'll set the component to be a client component to hold some state. This way we can use the new `useFormState` hook from `react-dom` and pass in our login server action. Within the action we'll call our `UserLogin` function from Fauna and set a cookie with the secret we get back that we can use throughout our application.
lessonDuration 2m 20s
When handling your loading and error states, you don't always want to render a result in place of the entire component. In our server-side search component, since we are making a new query when we update our input, the entire component re-renders, including the search input itself. To fix this we'd move those conditional renders into a ternary inside the component render.
lessonDuration 7m 45s
In this lesson you'll see a few concepts from previous lessons come together! Instead of just filtering the resulting data from a query in a client-side search, you can actually make your queries dynamic and do that filtering server-side.
lessonDuration 4m 25s
The resulting data from your queries is simple to use in your components. You will just need to consider the fact that the data is potentially undefined and work around that. In this lesson, you'll see how data from a query can be filtered with client-side search.
lessonDuration 1m 12s
`gcTime` stands for "garbage collection time" and it is the amount of time that must pass, when there are no components actively using a query, before the query is cleared from the cache. It is set independently from stale time!
lessonDuration 2m 4s
By just calling the `useQuery` hook with each of your queries, you can have them all running in parallel.
lessonDuration 1m 17s
`useQuery` follows the rules of hooks. You can wrap it in a custom hook for convenience if you want to layer in some additional functionality.
lessonDuration 3m 2s
There are nuances between the three loading states provided by the `useQuery` hook: - `isPending`: there's no data and a query hasn't been made yet. - `isFetching`: the query is being fetched - `isLoading`: there's no data, and there's a query currently being fetched. Notice that it's a combination of the above. In this lesson, you'll learn where you'd want to use each of these states.
lessonDuration 4m 2s
With the [useQuery](https://tanstack.com/query/latest/docs/framework/react/reference/useQuery#usequery) hook, you can make queries directly in your components! To get started you just need to provide a `queryKey` and a `queryFn`.
lessonDuration 15m 19s
lesson
lessonDuration 4m 48s
Creating an S3 bucket is a straightforward process. You just have to make sure that you are using a unique name. But, there are a couple of things you need to do in order to host a static site on an S3 bucket. First, under the properties tab, you need to enable static website hosting. Make sure to provide the index document to your app. Second, you need to add a bucket policy. You can find examples in the policy examples docs. In our case, we will use the example under "Granting read-only permission to an anonymous user" Bucket policy that was copy pasted: ``` { "Version": "2012-10-17", "Statement": [ { "Sid": "PublicRead", "Effect": "Allow", "Principal": "*", "Action":["s3:GetObject", "s3:GetObjectVersion"], "Resource:["arn:aws:s3:::DOC-EXAMPLE-BUCKET/*"] } ] } ```
lesson
lessonDuration 12m 33sFree
We have a list of some pretty amazing events, but two of your event managers just submitted the same event twice! :gasp: Does that mean they have to manually edit the Document’s fields? Likely not… we don’t want people having to manually edit a database. Instead, we can give the option to delete events, so that whether it's a typo or an invalid event, we can quickly get rid of it. As we can probably expect at this point, the Appwrite SDK not only gives us the flexibility to create, but also delete any Document or File we want. So that means, we can easily clean things up by passing in the ID of the Document or File we want and it's gone! The tricky part though, is how do we make sure we always delete the File associated with the Document so we don’t end up with a bunch of extra unnecessary files getting stored. In this lesson, we’ll first learn how we can use the Delete Document endpoint to delete any of our Database Collection entries. As we know, there’s a field within that Document that references a file, so we’ll see how we can first use that reference ID to delete the associated File, then continue on with the Document deletion process. And to do all of that, we’ll make sure we have the right permissions configured to avoid making unauthenticated requests! **What You’ll Learn** - Delete a Document from a Database Collection by ID - Delete a File referenced in a Document by ID - Configure Delete permissions for Documents and Files **Resources** - [Delete a Document](https://appwrite.io/docs/client/databases?sdk=web-default#databasesDeleteDocument) - [Delete a File](https://appwrite.io/docs/client/storage?sdk=web-default#storageDeleteFile)
lessonDuration 14m 11sFree
Up until this point, we’ve given our users free range to do whatever they want in their app. To be clear, we’ve done this intentionally, because we wanted to make things work, but now's the time to lock things down so only logged in users can perform actions in our app. But first, we need some kind of authentication method. We’ve been able to see how the Appwrite SDK makes working with these different services easy, but authentication takes this to another level. Authentication can be tricky. When we log a user in, they expect to be able to refresh the page and stay logged in, but to do this, we need to store something like an access token somewhere and there are a lot of security implications around how you do this! But Appwrite handles all of this for us, securely storing a cookie, so that any requests we make with our active session will pass that along and handle it for us. But for now, we just want to log them in, so we can easily get this process started by kicking off a new Magic Link session, verifying it, and getting our active session ready to go for interacting with it. We’ll start off by kicking an email to our user by creating a Magic Link session. Through this, we’ll want to also pass in the URL of the location we want our actual Magic Link to take them to when returning to the application, which in our instance, is a session page that will include URL parameters to read. Once they’re there, we’ll use URLSearchParams to read the param values and pass them to the verification endpoint to confirm the session, along with some UI updates to give feedback for their actions. **What You’ll Learn** - Register a new user or log in an existing user by creating a new Magic Link session - Verify a new session created from a Magic Link - Read an email from a form input - Get parameters from a URL with URLSearchParams - Show a message or redirecting after successfully submitting a form **Resources** - [Create a Magic Link session](https://appwrite.io/docs/client/account?sdk=web-default#accountCreateMagicURLSession) - [Verify a Magic Link session](https://appwrite.io/docs/client/account?sdk=web-default#accountUpdateMagicURLSession) - [URLSearchParams](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)