Want to improve your React JS Developer skills?
Whether you are an employer or an employee, you must have a certain skill that will help you to give the best in your role. Here I’m sharing some top learning React Js tips that will help you to grow your knowledge as well as your skills as a React JS Developer.

Tips for React JS Developers
1. Keep the components small
const InterestingFacts = props => (
Interesting Facts
{ props.facts.map(fact => ) }
);
2. Use functional components
function ShowName(props) {
return Welcome {props.name}!
}
The same component written in ES6:
const ShowName = ({name}) => Welcome {name}!
class ShowName extends Component {
render() {
return Welcome {this.props.name}!
}
}
3. Hooks
a. useState
We can use the React state feature in the functional component with useState. It returns two values: the current state and a function to update it. We can also set the default (initial) state value. We have to write like this: const [isVisible, setIsVisible] = useState(false)
. In class, this is similar to this.state.isVisible
and this.setState
.
import React, { useState } from 'react';
export default function ExampleComponent() {
const [isVisible, setIsVisible] = useState(false);
return (
{ isVisible && Bumper offer!
}
);
}
b. useEffect
import React, { useState, useEffect } from 'react';
export default function ExampleComponent() {
const [isVisible, setIsVisible] = useState(false);
const [offerText, setOfferText] = useState('No offer!');
// Similar to componentDidMount and componentDidUpdate:
useEffect(() => {
// Update the offer text
!isVisible && setOfferText('Bumper offer!');
}, [isVisible]);
return (
{offerText}
);
}
4. Always use PropTypes
import React from 'react';
import PropTypes from 'prop-types';
export default function MainButton({ className, title, onClick, isLoading }) {
return (
);
}
MainButton.propTypes = {
className: PropTypes.string,
title: PropTypes.string.isRequired,
onClick: PropTypes.func,
isLoading: PropTypes.bool,
};
5. DefaultProps
export default function MainButton({ className, title, onClick, isLoading }) {
return (
);
}
MainButton.defaultProps = {
className: '',
title: 'Submit',
isLoading: false,
};
6. React Fragment
Sometimes we need a wrap the children elements in a single element but we don’t need any extra DOM element. So using React.Fragment component we can return multipl elements in a render() method without creating an additional DOM element.
render() {
return (
Some text.
A heading
);
}
7. High Order Component
const Reverse = (PassedComponent) =>
({ children, ...props }) =>
{children.split("").reverse().join("")}
const name = (props) => {props.children}
const ReversedName = Reverse(name)
Hello
8. Memoizing
const memoizedValue = useMemo(() => computeExpensiveValue(a, b), [a, b]);
9. React with TypeScript
import * as React from 'react';
const ExampleComponent: React.FunctionComponent<{
name: string
}> = (props) => {
return {props.name}
}
export default ExampleComponent;
interface Props {
name: string
}
const ExampleComponent: React.FunctionComponent = (props) => {
return {props.name}
}
10. React Developer Tools

I hope all these tips will be useful for you. I will try to bring more similar concepts in the next article. Please feel free to ask in comment if you have something to add in this list or having any doubt or need more insights on particular point from above? please drop a comment. Thank you for reading.
–Nitesh Gour
A useful post indeed. Very helpful and easy to understand, looking forward to have more like these from you.
thanks.
Thanks for your appreciation!
Amazing write-up!
Thank You 🙂
It is a very helpful article. I found some points explanation is very simple and helpful for react-js beginners.
Thanks for reading!
I am glad that it is helpful for you.
Comments are closed.