Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-dom-factories

Package Overview
Dependencies
Maintainers
5
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-dom-factories

React package for DOM factory methods.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
125K
increased by4.54%
Maintainers
5
Weekly downloads
 
Created

What is react-dom-factories?

The react-dom-factories package provides a set of factory functions for creating React elements for DOM components. It is particularly useful for those who prefer to use plain JavaScript over JSX for creating React elements.

What are react-dom-factories's main functionalities?

Creating DOM Elements

This feature allows you to create DOM elements using factory functions. In this example, a `div` element containing an `h1` and a `p` element is created and rendered to the DOM.

const React = require('react');
const ReactDOM = require('react-dom');
const DOM = require('react-dom-factories');

const element = DOM.div({ className: 'container' },
  DOM.h1(null, 'Hello, World!'),
  DOM.p(null, 'This is a paragraph.')
);

ReactDOM.render(element, document.getElementById('root'));

Using Attributes and Children

This feature demonstrates how to use attributes and children with the factory functions. Here, an unordered list (`ul`) with three list items (`li`) is created and rendered.

const React = require('react');
const ReactDOM = require('react-dom');
const DOM = require('react-dom-factories');

const element = DOM.ul({ className: 'list' },
  DOM.li({ key: 1 }, 'Item 1'),
  DOM.li({ key: 2 }, 'Item 2'),
  DOM.li({ key: 3 }, 'Item 3')
);

ReactDOM.render(element, document.getElementById('root'));

Other packages similar to react-dom-factories

Keywords

FAQs

Package last updated on 26 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc