<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zannatul Fahmida</title>
    <description>The latest articles on DEV Community by Zannatul Fahmida (@zannatulfahmida).</description>
    <link>https://dev.to/zannatulfahmida</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F776956%2F074d7a5c-bd57-404a-a76a-da2a918c6e8a.png</url>
      <title>DEV Community: Zannatul Fahmida</title>
      <link>https://dev.to/zannatulfahmida</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zannatulfahmida"/>
    <language>en</language>
    <item>
      <title>Backend basics</title>
      <dc:creator>Zannatul Fahmida</dc:creator>
      <pubDate>Thu, 23 Dec 2021 15:36:06 +0000</pubDate>
      <link>https://dev.to/zannatulfahmida/backend-basics-8fh</link>
      <guid>https://dev.to/zannatulfahmida/backend-basics-8fh</guid>
      <description>&lt;p&gt;CRUD operations: CRUD operations are to create, read, update, and delete documents. &lt;br&gt;
Create or insert operations add new documents to a collection. If the collection does not currently exist, insert operations will create the collection. Create or insert operations uses the POST method.&lt;br&gt;&lt;br&gt;
The read function is similar to a search function. It allows users to search and retrieve specific records in the table and read their values. Users may be able to find desired records using keywords, or by filtering the data based on customized criteria. Read function uses the GET method.&lt;br&gt;
The update function is used to modify existing records that exist in the database. To fully change a record, users may have to modify information in multiple fields. Update function uses the PUT method.&lt;br&gt;
The delete function allows users to remove records from a database that is no longer needed. Delete function uses the DELETE method.&lt;/p&gt;

&lt;p&gt;JWT: JWT full form is JSON Web Token. It is an industry standard RFC 7519 method which secures two parties. It guarantees data ownership but not encryption. &lt;br&gt;
JWT is a useful technology for API authentication and server-to-server authorization. JWT claims to be encoded as a JSON object that is digitally signed using JSON Web Signature (JWS) and/or encrypted using JSON Web Encryption (JWE). JWT can be used between two parties to exchange information. JWT is digitally-signed and can be used in a secure public/private key pair. Information is verified using the public key on the other end. JWT can contain user information in the payload and can be used in the session to authenticate the user. Once authenticated, users can access protected resources in an application using the JWT included in the request. So, every request will be authenticated by verifying the JWT.&lt;/p&gt;

&lt;p&gt;Mongoose: Mongoose is an Object Data Modeling (ODM) library for MongoDB and Node.js. It manages relationships between data, provides schema validation, and is used to translate between objects in code and the representation of those objects in MongoDB. &lt;br&gt;
MongoDB is a schema-less NoSQL document database. It can store JSON documents in it, and the structure of these documents can vary as it is not enforced like SQL databases. This is one of the advantages of using NoSQL as it speeds up application development and reduces the complexity of deployments. A huge benefit of using a NoSQL database like MongoDB is that it is constrained to a rigid data model. Add or remove fields, nest data multiple layers deep, and have a truly flexible data model that meets our needs today and can adapt to our ever-changing needs. But being too flexible can also be a challenge. If there is no consensus on what the data model should look like, and every document in a collection contains vastly different fields, then it will have a bad time.&lt;br&gt;
A schema defines document properties through an object where the key name corresponds to the property name in the collection. While Mongo is schema-less, SQL defines a schema via the table definition. A Mongoose schema is a document data structure that is enforced via the application layer. A schema definition should be simple, but its complexity is usually based on application requirements. Schemas can be reused and they can contain several child-schemas too. In the example above, the value of the email property is a simple value type. However, it can also be an object type with additional properties on it.&lt;br&gt;
MongoDB Schema Validation makes it possible to easily enforce a schema against your MongoDB database, while maintaining a high degree of flexibility, giving you the best of both worlds. In the past, the only way to enforce a schema against a MongoDB collection was to do it at the application level using an ODM like Mongoose, but that posed significant challenges for developers.&lt;br&gt;
Models are higher-order constructors that take a schema and create an instance of a document equivalent to records in a relational database.&lt;br&gt;
A Mongoose model is a wrapper on the Mongoose schema. A Mongoose schema defines the structure of the document, default values, validators, etc., whereas a Mongoose model provides an interface to the database for creating, querying, updating, deleting records, etc.&lt;br&gt;
Mongoose has a flexible API and provides many ways to accomplish a task. Most of the operations can be done in more than one way either syntactically or via the application architecture.&lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>beginners</category>
    </item>
    <item>
      <title>React Basics</title>
      <dc:creator>Zannatul Fahmida</dc:creator>
      <pubDate>Wed, 22 Dec 2021 14:41:10 +0000</pubDate>
      <link>https://dev.to/zannatulfahmida/react-basics-3adp</link>
      <guid>https://dev.to/zannatulfahmida/react-basics-3adp</guid>
      <description>&lt;p&gt;PropTypes: Props are used to pass information to any component. Prop-types are used to document the intended types of properties passed to components. React will check props passed to components against those definitions, and warn in development if they don’t match. The PropTypes utility exports a wide range of validators for configuring type definitions.&lt;br&gt;
Below are the validators for the basic data types:&lt;br&gt;
PropTypes.any: The prop can be of any data type.&lt;br&gt;
PropTypes.bool: The prop should be a Boolean.&lt;br&gt;
PropTypes.number: The prop should be a number.&lt;br&gt;
PropTypes.string: The prop should be a string.&lt;br&gt;
PropTypes.func: The prop should be a function.&lt;br&gt;
PropTypes.array: The prop should be an array.&lt;br&gt;
PropTypes.object: The prop should be an object.&lt;br&gt;
PropTypes.symbol: The prop should be a symbol.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const isEmail = function (propValue, key, componentName, location, propFullName) {
    const regex = /^((([^&amp;lt;&amp;gt;()[]\.,;:s@"]+(.[^&amp;lt;&amp;gt;()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,})))?$/;

    if (!regex.test(propValue[key])) {
        return new Error(`Invalid prop `${ propFullName }` passed to `${ componentName }`. Expected a valid email address.`);
    }
}

Component.propTypes = {
    emails: PropTypes.arrayOf(isEmail)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;State-props: Props and state are both plain JavaScript objects. State is managed within the component like variables declared within a function. State allows components to create and manage their own data. Using state components cannot pass data but they can create and manage it internally.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';
const AddPlants = () =&amp;gt; {
    const [name, setName] = useState('');
    return (
        &amp;lt;div&amp;gt;
            &amp;lt;TextField
                sx={{ width: { xs: '100%', md: '50%' }, mb: 2 }}
                id="standard-basic1"
                label="Plant Name"
                name="name"
                onBlur={(e) =&amp;gt; setName(e.target.value)}
                variant="standard"
            /&amp;gt;
            &amp;lt;ul&amp;gt;
                &amp;lt;li&amp;gt;{name}&amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/div&amp;gt;
    )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Props are used to pass information to any component. React’s data flow between components is uni-directional which means it passes data from parent to child only. Data from props is read-only.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';
const AddPlants = (props) =&amp;gt; {
    const {name, id, price} = props.plants;
    return (
        &amp;lt;div&amp;gt;
            &amp;lt;ul&amp;gt;
                &amp;lt;li&amp;gt;{name}&amp;lt;/li&amp;gt;
                &amp;lt;li&amp;gt;{id}&amp;lt;/li&amp;gt;
                &amp;lt;li&amp;gt;{price}&amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/div&amp;gt;
    )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;JSX: JSX full form is JavaScript XML. Using JSX we can write HTML in React. JSX makes it easy to write and add HTML in React. It converts HTML tags into react elements.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myelement = &amp;lt;h1&amp;gt;React is times better with JSX&amp;lt;/h1&amp;gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Component Lifecycle: Each component has several “lifecycle methods” that we can override to run code at particular times in the process. A React Component can go through four stages of its life those are given below:&lt;br&gt;
Mounting: Mounting is the stage of rendering the JSX returned by the render method itself. This method creates and inserts an instance of a component into the DOM.&lt;br&gt;
Updating: Updating is the stage when the state of a component is updated and the application is repainted. This method happens when props or states are changed.&lt;br&gt;
Unmounting: As the name suggests Unmounting is the final step of the component lifecycle where the component is removed from the page. &lt;br&gt;
Error Handling: This method is called when there is an error during rendering, in a lifecycle method, or in the constructor of any child component.&lt;/p&gt;

&lt;p&gt;Hooks: Hooks allow us to "hook" with react features. It can be called only inside react function components and at the top level of a component. It cannot be conditional. Some hooks are given below: &lt;br&gt;
useState&lt;br&gt;
useEffect&lt;br&gt;
useContext&lt;br&gt;
useReducer&lt;br&gt;
useCallback&lt;br&gt;
useMemo&lt;br&gt;
useRef&lt;br&gt;
useImperativeHandle&lt;br&gt;
useLayoutEffect&lt;br&gt;
useDebugValue&lt;/p&gt;

</description>
      <category>react</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
