Skip to content

use functional component when you have stateless component #21

Description

@tawfiknasser

https://medium.com/@Zwenza/functional-vs-class-components-in-react-231e3fbd7108

import React from "react";
import './Data.css'
export default class Data extends React.Component {
render() {
const { categoryData, chosenCat } = this.props;
let currentCategory = "";
if( chosenCat == "Social Medias") currentCategory = "SocialMedia";
else if( chosenCat == "News") currentCategory = "News";
else if( chosenCat == "Search Engines") currentCategory = "SearchEngines"
else currentCategory = "Static";
return (
<div className="data--container">
<h3>{categoryData[currentCategory].name}</h3>
<p>{categoryData[currentCategory].desc}</p>
</div>
);
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions