Skip to content

Stateless functional components #6

@ghost

Description

https://github.com/sikandar47/jamming/blob/master/src/Components/SearchResults/SearchResults.js

The class syntax is the standard way to define a React component. But it's kind of a lot of ritual for a component that doesn't refer to this.state and only has a render() function.

In these situations, and if you're confident that a component won't eventually need to hold its own state, it's often preferable to write your component as a stateless functional component rather than a full blown component using class.

These are equivalent ways to define a component, but just so you're aware of your options when writing your own code and also when reading somebody else's. Read more here!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions