A few Controlled components for React.js that i use in my apps.
Controlled components do not maintain their own value as a state.
They get it from a parent component, along with a function to let the parent know an action to change the value has occurred.
- Install the package using npm:
npm install --save react-controlled-components
- Import the required components (for example:
import { Button } from 'react-controlled-components';
) - That's it! the components are ready for use.
A simple image component that lets you provide a placeholder source incase the main one fails.
An image that will navigate to a provided url when clicked.
A simple text input.
A simple toggle component.
A simple button.
All components have a prop named className
which allows you to pass a string for a class to be placed on the root element of a container.