When should you use brackets with React?

To put brackets or not to put brackets... This can be a complicated subject when you're new to React! Let's find out together when to use brackets and when not to.
•
Updated on August 14, 2026
•
1 min read
Believemy logo

Using parentheses or not... That's a topic that can seem quite complicated when we start with React! Let’s discover together when to add them and when to never add them.

 

Situations Where You Need to Use Parentheses

When we want to immediately execute the function:

JAVASCRIPT
myFunction();

Or when we want to pass parameters:

JAVASCRIPT
<MyComponent myProp={() => myFunction('Elon')} />

 

Situations Where You Should Not Use Parentheses

When we just want to pass a reference to a function/method to a component, so that it can execute it later:

JAVASCRIPT
<MyComponent myProp={myFunction} />
Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

Creating a markdown previewer with React

Creating a real markdown previewer with React, and above all, doing it correctly, requires real concentration! Fortunately, with a little help anyone can do it. Here are a few tips for creating your own markdown previewer!

December 9, 2024

Class-based component VS Functional Component with React

Have you always wondered about the difference between a component using a class and a component in the form of a function with React? Then this article is for you!

December 9, 2024

What's new in React 19

React 19 has just been announced by the Meta team. Powerful new features have been introduced almost two years after the release of React 18.3. Let's find out what's new with React 19.

December 5, 2024

Code faster with React using these techniques

Learn how to code faster with React thanks to simple but effective techniques used by experienced developers.

December 9, 2024

Understanding .env files with ReactJS

Find out how to really use the .env file with React or NextJS so you never make a mistake again.

December 9, 2024

How to use React's useEffect and useRef hooks?

Discover the best practices to adopt with useEffect and useRef, what they're for and how to use them in the right way.

December 11, 2024

All about the new React Hook: useOptimistic

Discover useOptimistic, the React hook that makes your interfaces more responsive with instant updates. Streamline your user experience and simplify error handling. Slug: all about the new-hook-react-useoptimistic

December 9, 2024

The complete guide to React Toastify

Discover the complete guide to React Toastify, a powerful library for managing notifications in React. Learn how to install, configure and customise all your toasts easily with concrete examples and advanced tips.

December 6, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.