New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-refrax

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-refrax

Create a reactive react component

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Refrax

Refrax turns your React component into a reactive component where it will automatically updates when you changed your model. This might be against Thinking in React guidelines.

Refrax utilize ES6 property getter/setter to detect changes.

The name Refrax originated from Refraction, because it try to refract your model changes into your React component.

Example

Start by creating your model schema.

const model = new RefractModel({
    schema(){
        return {
            name: 'John Doe'
        }
    }
})

Then wrap your component with <RefractComponent>, passing your model to the <RefractComponent>.

ReactDOM.render(<RefraxComponent model={model}><MyComponent/></RefraxComponent>)    

Then you can change your model directly and Refrax will refract that changes into your React component.

this.props.model.name = 'Jane Doe';

You can run the test/index.html file and see it in action.

IMPORTANT

This is not a production grade project, I am creating this as one of my learning materials on React. I am inspired by Vue reactive model and try to implement it without looking at Vue or React code at all.

Because I am not familiar with React, I might not be utilizing it to the fullest and some optimization might be needed (e.g forceUpdate() is called to refract the model changes, probably bad, not really sure).

CONTRIBUTION

You can help contributing to this project by writing documentation, doing optimization, or implementing new feature.

FAQs

Package last updated on 03 Oct 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